HH versus HT Pattern Expectations in Sequences of Coin Flips

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

This Demonstration considers a sequence of fair coin flips and computes the expected number of tosses until heads are immediately preceded by heads and similarly for the pattern. At first you might expect that those values must be the same, because the probability of getting a or after the first is the same. The theoretical values are and .


See the histogram of the flips between and patterns. Use the the "random seed" slider to explore different random sequences.


Finally, you can set the "show cases" slider to 1 and change the "random seed" slider to observe which pattern comes first on average.


Contributed by: Jan Fiala (March 2011)
(University of Virginia’s College at Wise)
Open content licensed under CC BY-NC-SA



Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.