Skip to content
← Back to all questions
FreeProbabilityMedium

10 Consecutive Heads

Asked atCitadelIMC TradingJane StreetSusquehanna International GroupTwo Sigma

Question

You flip a fair coin until you get 1010 heads in a row. What is the expected number of flips?

Solution

Try it yourself first. Open a hint if you get stuck.

Hint 1

Build the run one head at a time. Let TkT_k be the expected number of flips until you first have kk heads in a row. How is Tk+1T_{k+1} related to TkT_k?

Hint 2

To get k+1k + 1 in a row, you must first get kk in a row, then flip once more. Heads: done. Tails: you are back at the start and still need Tk+1T_{k+1} flips on average.

Show solution

Let TkT_k be the expected number of flips until you first see kk heads in a row, with T0=0T_0 = 0.

Step 1: From kk heads in a row to k+1k + 1. To get k+1k + 1 heads in a row, you first need kk in a row, which takes TkT_k flips on average. Then you flip once more:

  • Tails (probability 12\tfrac12): the run is broken. You have used Tk+1T_k + 1 flips and are back at the start, so you still need Tk+1T_{k+1} more flips on average. Total: Tk+1+Tk+1T_k + 1 + T_{k+1}.
  • Heads (probability 12\tfrac12): you now have k+1k + 1 in a row and you are done. Total: Tk+1T_k + 1.

Averaging the two cases:

Tk+1=12(Tk+1+Tk+1)+12(Tk+1).T_{k+1} = \tfrac12\big(T_k + 1 + T_{k+1}\big) + \tfrac12\big(T_k + 1\big).

Step 2: Simplify. The right side is Tk+1+12Tk+1T_k + 1 + \tfrac12 T_{k+1}. Subtract 12Tk+1\tfrac12 T_{k+1} from both sides and multiply by 22:

Tk+1=2Tk+2.T_{k+1} = 2T_k + 2.

Step 3: Solve. Start from T0=0T_0 = 0 and apply the rule ten times:

T0,T1,…,T10=0, 2, 6, 14, 30, 62, 126, 254, 510, 1022, 2046.T_0, T_1, \dots, T_{10} = 0,\ 2,\ 6,\ 14,\ 30,\ 62,\ 126,\ 254,\ 510,\ 1022,\ 2046.

Each value is 22 less than a power of 22: Tk=2k+1−2T_k = 2^{k+1} - 2. (Adding 22 to both sides of the rule gives Tk+1+2=2(Tk+2)T_{k+1} + 2 = 2(T_k + 2), so Tk+2T_k + 2 doubles every step.)

Check: T1=2T_1 = 2 is the familiar expected wait for a single head.

Answer:

T10=211−2=2046.T_{10} = 2^{11} - 2 = 2046.