Explore modules

Waiting Time for Coin Patterns

See how self-overlap changes the waiting time for an exact coin pattern.

Free theory article

See how self-overlap changes the waiting time for an exact coin pattern.

Concept & interpretation

When repeatedly flipping a coin, analyzing the time until a specific sequence of heads (H) and tails (T) first appears is a classic problem in discrete stochastic processes. Unlike the geometric waiting time for a single success, the expected waiting time for a longer pattern is heavily influenced by how the pattern overlaps with itself.

Interactive Experiment

Use the interactive module to explore how the expected waiting time and the transient probability of hitting the pattern by a given horizon change. You can adjust the coin's bias and see the underlying finite-state automaton that tracks the longest matched prefix at any given step.

  1. Pattern: Choose different sequences to see how self-overlap affects the waiting time.
  2. Head probability: See what happens as the coin becomes biased towards heads or tails. Notice how the expected time becomes Infinite if the sequence requires a side that has zero probability.
  3. Horizon: Adjust the number of flips to see how the transient probability P(T ≤ N) evolves in the trace table over time.
Read the full free theory article