Quoto

Learn / Library / Probability

Race of coin patterns

ProbabilityHard

A fair coin is tossed repeatedly and independently. Pattern and pattern are both watched in the sequence of results ( is heads, is tails), and overlaps with earlier tosses count. What is the probability that appears before ? Give a fraction 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

Use states describing the useful suffix of the sequence so far: nothing, , . Note that after the pattern is certain to come first.

Solution
  1. Let be the probability that comes first from the start state, from state , and from state .
  2. From the pattern must win, because more heads keep us in until a tails arrives; so from , a heads gives and a tails leads to : .
  3. From , a heads completes and a tails returns to the start: .
  4. From the start, a tails keeps us at the start and a heads leads to : .
  5. Substituting, , so , which gives .
  6. Therefore the probability is .

Answer: