Expected value round, frequently paired with a Markov chain follow-up.

Waiting for two heads in a row

Hard

The question

What is the expected number of fair coin flips until you see two heads in a row?

Have a go before you open the solution. If you are stuck after a few minutes, the first paragraph below is usually enough of a nudge.

Show the worked solution

The answer

6.

Define states by progress: S0 with no trailing head, S1 with one trailing head.

From S0, one flip either moves to S1 or returns to S0, so E0 = 1 + (E1 + E0)/2.

From S1, one flip either finishes or drops back to S0, so E1 = 1 + E0/2.

Substituting gives E0 = 6. The general result for k heads in a row with a fair coin is 2^(k+1) - 2, which is worth knowing because the follow-up is usually 'now do three'.

What it is testing

Whether you build a small state machine rather than guessing.

Try these next

Preparing properly

Live opportunities

Interviewing soon? See who is hiring

Open vacancies we track at quant firms, grouped by role and city. Adverts are anonymised.

Hiring for these roles? Brief the desk on a hire or check your fit for a role.

Research desk

Speak to a quant market specialist

Ask what a firm really pays, how a desk hires, or where your profile sits. One reply from the research desk, in confidence, no obligation.