You flip a fair coin until the pattern THH appears as three consecutive tosses. What is the expected number of flips?
Reveal solutionHide solution
#States of progress
Track the longest tail of the tosses so far that is also a start of THH. That gives four states, start with no progress, , , and the finished . Let , , be the expected flips still needed from start, from , and from .
#The fallback from TH is the key
From start, a head is wasted and keeps you at start, while a tail advances to . From , a tail just resets to a fresh and a head advances to . From , a head finishes, but a tail does not erase everything, since that new tail is itself the first symbol of THH, so the chain falls back only to .
#Solve
The three equations simplify to , , and . Substituting the last into the second, , so , then and
#Compare
THH takes only flips against HHH's . A stumble near the end of THH keeps its leading tail and costs little, whereas a tail at the end of an HHH attempt wipes the whole run and sends you back to the start.