Lesson goal: The Gambler's Fallacy and coin streaks

Previous: The shape of luck: Sum of two dice | Home | Next: Rolling doubles and going to jail

Suppose you flip a fair coin 5 times, and every single flip comes up Heads: H-H-H-H-H.

What would you bet on for the 6th flip? Most people feel a powerful, natural urge to bet on Tails, thinking: "Tails is due! Heads has come up too many times!"

This common psychological trap is known as the Gambler's Fallacy. In reality, a coin has no brain and no memory. It doesn't know what it landed on a moment ago!

In this lesson, we will simulate flipping a coin $50{,}000$ times. Every time we encounter a streak of 5 consecutive Heads, we'll examine what the 6th flip turned out to be. Are Tails really more likely after a streak? Let's find out!
if streak == target_streak then ... end
Move the mouse over a dotted box for more information.

Notice how the probability of getting Heads or Tails on the flip immediately following a 5-head streak remains stubbornly at $50/50$.

Now you try. Try testing for streaks of 8 or 10 heads! You will see fewer total streaks in 50,000 flips, but the next flip will still be around 50% heads and 50% tails.

Type your code here:


See your results here: