Why patterns overlap

Separate a pattern’s chance in one window from the time you wait for it

One window is not a waiting time

HHHT1/41/4P(H) = P(T) = 1/2
Both patterns have chance 1/4 in a fixed two-toss window.

Heads (H) · Tails (T)

Assume independent tosses of a fair coin. HH and HT each have probability 1/4 in two tosses. But a search keeps going until a pattern first appears. Its windows overlap, so counting them as independent opportunities gives the wrong answer.

Lesson help

A fixed window’s probability, average waiting time and chance of winning a race are different quantities.

About this lesson

Try the method in a practice when you are ready.

Report

One window is not a waiting time

Heads (H) · Tails (T)

Assume independent tosses of a fair coin. HH and HT each have probability 1/4 in two tosses. But a search keeps going until a pattern first appears. Its windows overlap, so counting them as independent opportunities gives the wrong answer.

HHHT1/41/4P(H) = P(T) = 1/2
Both patterns have chance 1/4 in a fixed two-toss window.

Keep useful partial progress

While waiting for HT, another H after H keeps you ready for the next T. While waiting for HH, a T after H erases that progress. Tracking these states gives mean waits of 4 tosses for HT and 6 for HH.

HHHT64
An H after H preserves the partial progress toward HT.

Compare the overlaps

For a fair coin, each beginning that is also an ending contributes 2 raised to its length to the mean wait. HHH overlaps at lengths 1, 2 and 3: 2 + 4 + 8 = 14. HHT overlaps only at its full length: 8.

HHH: 2 + 4 + 8 = 14HHT: 88 < 14
Overlap changes the waiting time.

Try it

Which fair-coin pattern has the shorter mean waiting time?

  1. HHH
  2. HHT
Show the answer

HHT

Correct. HHT needs 8 tosses on average, compared with 14 for HHH.

Enable JavaScript to answer interactively and save your place.

Practice Pattern races

Sign in free

Practice without limits and keep your progress.