On this page
Toss a fair coin until two heads come up back to back, then count the tosses. Do this many times and the average settles at 6. This is a classic JEE-style expectation question. A common first guess is 4, so it is worth seeing exactly where the 6 comes from.
What is the expected number of tosses to get two heads in a row?
The expected number of tosses is the long-run average of how many tosses a run takes, counting the two final heads. Course notes from Cornell's INFO295 give the general result: for a coin that lands heads with probability p, the average wait for two heads in a row is (1 + p)/p². Put in p = ½ and you get 6.
If you have not yet done the simpler version, start with why the expected wait for the first head is 2.
How do you set up the equation by conditioning on the first tosses?
Call the answer E. Now ask how a run can begin. There are only three cases, and between them they cover every possibility:
The first toss is T (probability ½). You have used 1 toss and you are back at the start, so you still expect E more. Total: E + 1.
The first two tosses are HT (probability ¼). You have used 2 tosses, and the T wipes out your progress. Total: E + 2.
The first two tosses are HH (probability ¼). You are done in exactly 2 tosses.
Multiply each total by its probability and add them up:
E = ½(E + 1) + ¼(E + 2) + ¼ × 2
E = ¾E + ½ + ½ + ½
¼E = 3/2, so E = 6.
Why is the answer 6 and not 4?
The tempting argument: HH has probability ¼, so it should take 1/(¼) = 4 tries. But the tries overlap and are not independent, since tosses 1–2 and 2–3 share toss 2. Overlap also makes HH come in clumps (HHH contains two). HH still fills a quarter of positions in a long sequence, but because the hits bunch together, the wait for the first one averages 6.
The spread of outcomes also explains why 6 feels too high. According to the same Cornell notes, the chance of finishing on toss 2 is ¼, and on toss 3 and toss 4 it is ⅛ each. Add those up and half of all runs are over by toss 4. The rest can drag on for a long time, and those long runs pull the average up to 6.
Does a quick simulation agree?
We drew 200 random 0s and 1s from RANDOM.ORG, counted 1 as heads, and started a fresh run after every HH. The link uses a fixed identifier, so it shows the same 200 tosses each time and you can check our count.
Runs completed: 36, using all 200 tosses.
Average run length: 200 ÷ 36 ≈ 5.6 tosses.
Runs over by toss 4: 19 of 36, close to the half that theory predicts.
Longest run: 32 tosses, a single run that pulls the average up by itself.
With only 36 runs, the average can easily land half a toss or more away from 6, so 5.6 fits the theory well.
How do you extend it to three heads or a biased coin?
The same conditioning gives 14 tosses for three heads in a row and 2ⁿ⁺¹ − 2 for n heads in a row, as the Cornell notes show. Every extra head roughly doubles the wait.
For a coin with heads twice as likely as tails (p = ⅔), the formula gives (1 + ⅔) ÷ (4/9) = 15/4, or 3.75 tosses. For the probability side of that coin, see two-toss probabilities for a biased coin.
As a contrast, try the pattern HT. First you wait for an H, which takes 2 tosses on average. After that, any T finishes the pattern and any H keeps you waiting in the same spot, so that takes another 2 tosses. The total is 4. HT cannot overlap with itself, so the simple 1/(¼) answer works for it. HH takes longer because a miss sends you all the way back to the start, while for HT a miss costs you nothing.
A quick checklist for any "expected tosses until a pattern" question:
Name the unknown, E.
List the ways the first toss or two can go, making sure no case is missed and no two cases overlap.
For each case, write the tosses used plus what is still left to go (E again, or 0).
Solve the linear equation, then check the answer with p = 1 or a small tally.
The same conditioning trick solves the probability of winning a game from deuce. If you get stuck on the setup step, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer.



