Problem 6.8 Medium Free 1 variation

HHT Before HTT

A fair coin is flipped repeatedly until either the pattern HHTHHT or the pattern HTTHTT has appeared as a run of three consecutive flips. Find the probability that HHTHHT appears first.

{# Answer box. In the full site the answer is never in the page: "Show answer" fetches it (actions.reveal). In the free-only public site (free problems only) it is built in. #}

Work it out, then compare with the answer.

{# Solution. Full site: fetched when opened (actions.reveal), so it is never in the page source. Free-only public site (free problems only): built in. #}
SolutionShow the worked solution

Neither pattern can be completed until a head has appeared. So any initial tails can be ignored, and we may start in the state “last flip HH, no further progress”. Track the relevant suffix of the sequence:

  • SHS_H: the last flip is HH, and it is not preceded by a useful HH;
  • SHHS_{HH}: the last two flips are HHHH;
  • SHTS_{HT}: the last two flips are HTHT, following a reset or a start.

Let aa, bb, cc be the probabilities that HHTHHT appears first from SHS_H, SHHS_{HH} and SHTS_{HT} respectively.

From SHHS_{HH}, a head leaves us in SHHS_{HH} and a tail completes HHTHHT. Two consecutive tails can never occur from here without first producing HHTHHT, so b=1b=1.

From SHS_H, a head moves to SHHS_{HH} and a tail moves to SHTS_{HT}:

a=12b+12c=12+12c.a = \tfrac12 b + \tfrac12 c = \tfrac12 + \tfrac12 c.

From SHTS_{HT}, a tail completes HTTHTT, a loss. A head gives the suffix HTHHTH. Its last HH is a fresh start, because neither pattern can use the preceding HTHT, so we return to SHS_H:

c=12⋅0+12a.c = \tfrac12\cdot 0 + \tfrac12 a.

Substituting gives a=12+14aa = \tfrac12 + \tfrac14 a, so a=23a=\tfrac23.

23\boxed{\tfrac23}

Key idea. Once HHHH appears, HHTHHT is certain to win. Thus HHTHHT wins exactly when HHHH occurs before HTTHTT.

Variations

The same idea with a twist. Each solution gives only the changed step.

Variation 6.8a

Alice and Bob flip a fair coin repeatedly and record the sequence of outcomes. Alice wins if the pattern HTHHTH appears before the pattern HHTHHT; otherwise Bob wins. Find the probability that Bob wins.

{# Answer box. In the full site the answer is never in the page: "Show answer" fetches it (actions.reveal). In the free-only public site (free problems only) it is built in. #}

Work it out, then compare with the answer.

{# Solution. Full site: fetched when opened (actions.reveal), so it is never in the page source. Free-only public site (free problems only): built in. #}
Solution

Use the same states after the first head. Now let pp and qq be the probabilities that Bob (HHTHHT) wins from SHS_H and from SHTS_{HT}.

From SHHS_{HH} Bob wins with probability 11, exactly as before.

From SHTS_{HT}, a head completes HTHHTH, so Alice wins. A tail gives HTTHTT, which is useless to both players, so we must wait for the next head and return to SHS_H. Hence q=12pq=\tfrac12 p.

From SHS_H we have p=12⋅1+12q=12+14pp=\tfrac12\cdot 1+\tfrac12 q = \tfrac12+\tfrac14 p, so p=23p=\tfrac23.

23\boxed{\tfrac23}