Quant Memo
Foundational

Why HHH Takes Longer to Appear Than HHT

Two 3-flip patterns with identical single-shot probability take very different average numbers of flips to first appear — because one can reuse partial progress toward itself and the other can't.

Prerequisites: Conditional Probability

The problem. Flip a fair coin repeatedly. On average, how many flips until you first see HHH? How many until you first see HHT? Both are specific 3-flip sequences, each with probability 18\frac{1}{8} of occurring in any given window of 3 flips — so it's tempting to guess the waiting times are equal. They aren't: HHT appears after 8 flips on average, while HHH takes 14. The gap comes entirely from what happens when a near-miss occurs.

The key idea: what a failed attempt leaves behind

Suppose you're chasing HHH and you've just flipped H, H, and then the coin comes up T. You needed HHH but got HHT — total failure, and you have to start over from scratch, because a T wipes out any H-streak. Now suppose you're chasing HHT and you've flipped H, H, then the third flip comes up H again (not T). You haven't completed HHT, but you haven't lost anything either — you still have "HH" as your current progress, exactly where you'd want to be if you're two flips into building toward HHT. A failed attempt at HHT still leaves useful partial progress behind; a failed attempt at HHH (specifically, hitting a T after any number of H's) destroys all progress instantly.

Worked example: setting up the states for HHT

Model progress toward HHT as a Markov chain with states: S0S_0 (no useful progress), SHS_H (just saw an H), SHHS_{HH} (just saw HH), and "done" (saw HHT). From S0S_0: flip H moves to SHS_H (prob 12\frac12), flip T stays at S0S_0 (prob 12\frac12). From SHS_H: flip H moves to SHHS_{HH}, flip T moves back to S0S_0. From SHHS_{HH}: flip H stays at SHHS_{HH} (because "HH" is still valid progress toward HHT after another H), flip T completes to "done." Let E0,EH,EHHE_0, E_H, E_{HH} be expected additional flips from each state:

EHH=1+12EHH+12(0)    EHH=2.E_{HH} = 1 + \tfrac12 E_{HH} + \tfrac12(0) \;\Rightarrow\; E_{HH} = 2. EH=1+12EHH+12E0,E0=1+12EH+12E0.E_H = 1 + \tfrac12 E_{HH} + \tfrac12 E_0, \qquad E_0 = 1 + \tfrac12 E_H + \tfrac12 E_0.

Solving: from the E0E_0 equation, 12E0=1+12EH\tfrac12 E_0 = 1 + \tfrac12 E_H, so E0=2+EHE_0 = 2 + E_H. Substituting into EH=1+12(2)+12E0=2+12(2+EH)=3+12EHE_H = 1 + \tfrac12(2) + \tfrac12 E_0 = 2 + \tfrac12(2+E_H) = 3 + \tfrac12 E_H, giving EH=6E_H = 6, and E0=8E_0 = 8. Starting from scratch, HHT takes 8 flips on average.

Why HHH is worse: self-overlap costs you the progress

Redo the chain for HHH: from SHHS_{HH} (just saw HH), a flip of H completes HHH, but a flip of T sends you all the way back to S0S_0 — unlike HHT's chain, where the failing flip only cost you the "T" attempt while H kept you at SHHS_{HH}. Solving the analogous equations gives E0=14E_0 = 14 for HHH — a full 6 flips worse than HHT, purely because every near-miss on HHH (a T after any H's) wipes the slate clean, while HHT's near-misses (extra H's) do not.

Path explorer
13055time →
end (bold path) 100.38spread of ends 58.966 independent paths, same settings

Think of each sample path above as a run of coin flips: the "waiting time" question asks how long, on average, before a specific short pattern first appears somewhere along the path — a natural first-passage question the explorer's paths make visually intuitive.

Two equally probable patterns can have very different expected waiting times. The determining factor is self-overlap: patterns whose prefixes can reappear as suffixes (like HH inside HHH) let a near-miss still count as partial progress, or in HHH's specific case, let a single wrong flip erase all progress — model the chase as a Markov chain over "current progress" states to get the exact number.

Don't assume equal single-window probability means equal waiting time. 18\frac18 probability per 3-flip window is about the chance in one shot; expected waiting time is about how much progress survives a near-miss, which depends on the pattern's internal structure, not on its raw probability.

Related concepts

Practice in interviews

Further reading

  • Grinstead & Snell, Introduction to Probability, ch. 11
ShareTwitterLinkedIn