Waiting for HTHT
A fair coin is tossed until the four most recent tosses read . Find the expected number of tosses.
Fractions, decimals with at least 3 significant digits, and expressions such as sqrt(2)/2, e^-1 or pi/4.
A Markov chain on the prefixes works. A faster route uses a fair betting game: before each toss a new gambler arrives with 1 dollar and bets on the pattern.
Each gambler bets everything on the next letter of at fair odds, doubling or losing all. When the pattern appears, which gamblers are still holding money?
h
s Shown after a correct answer. Revealing it first marks the problem as seen, not solved.
Idea. Run a fair casino. Because every bet is fair, the casino's expected profit at the stopping time is zero, so the expected number of tosses equals the expected total paid out at the end. That payout depends only on how the pattern overlaps with itself.
Step 1: the game. Before toss , gambler arrives with 1 dollar and bets it on H. If she wins she has 2 dollars and bets it on T for the next toss, then 4 dollars on H, then 8 dollars on T. She leaves as soon as she loses. Each bet is fair.
Step 2: zero expected profit. The casino collects 1 dollar per toss and its net gain is a martingale. With the stopping time (it has finite mean), optional stopping gives where is the money held by the gamblers when appears.
Step 3: the payout. At the moment appears:
- the gambler who started at the first H of the pattern has won bets: 16 dollars;
- the gambler who started at the second H has won bets (): 4 dollars;
- the gamblers who started on a T have lost.
So .
In general. over all such that the first letters of the pattern equal its last letters. For this gives ; for , which has no overlap, just .