Quoto

Learn / Library / Probability

Waiting for a coin pattern

ProbabilityHard

A biased coin lands heads with probability and tails with probability , with independent flips. What is the expected number of flips until the pattern heads, tails, heads first appears in consecutive flips? Give a fraction a/b in lowest terms.

Checking an answer needs JavaScript. The hint and the solution open without it.

A whole number, a decimal, a fraction like 3/8 or a percent.

Hint

Track the longest suffix of the flips that matches the start of the pattern: nothing, heads, or heads then tails.

Solution
  1. Let , , be the expected further flips when the matched suffix is empty, heads, or heads then tails.
  2. From empty: , so .
  3. From heads: a head keeps us there and a tail moves on, so , giving .
  4. From heads then tails: a head finishes, a tail resets, so .
  5. Combining gives , so and .

Answer: