Coin Flip Simulator

Flip virtual coins and explore probability, streaks, and the law of large numbers

Overview

The Coin Flip Simulator provides an interactive way to explore binary probability through virtual coin flips. Flip single coins or simulate thousands of flips to understand fundamental probability concepts, streaks, and the law of large numbers.

Features

  • Animated Coin Flips: Visual coin flip animation for single flips
  • Streak Tracking: Track consecutive heads or tails in real-time
  • Bias Control: Adjust coin fairness from 0% to 100% heads probability
  • Mass Simulation: Flip up to 100,000 coins for statistical analysis
  • Visual Analytics: Cumulative proportions, streak distributions, sequence visualization
  • Probability Analysis: Z-scores and deviation from expected values

Key Concepts

Fair Coin

A fair coin has exactly 50% probability for each outcome: - P(Heads) = 0.5 - P(Tails) = 0.5 - Each flip is independent

Important: The coin has no memory - previous results don’t affect future flips!

The Gambler’s Fallacy

One of the most common probability misconceptions:

Fallacy: “After 5 heads in a row, tails is due!”

Reality: The next flip still has exactly 50% chance of heads.

The simulator helps visualize why this fallacy is wrong by showing that streaks occur naturally in random sequences.

Law of Large Numbers

As the number of flips increases, the proportion approaches the true probability:

  • 10 flips: Might see 7 heads (70%) - normal variation
  • 100 flips: Maybe 58 heads (58%) - closer to 50%
  • 1,000 flips: Around 510 heads (51%) - very close to 50%
  • 10,000 flips: Approximately 5,005 heads (50.05%) - almost exactly 50%

Key insight: The proportion converges to 0.5, but the absolute difference often grows!

Streaks and Runs

Streak: Consecutive identical outcomes (e.g., HHHHH)

Expected streaks in N flips: - 100 flips: Expect streaks of 5-7 - 1,000 flips: Expect streaks of 9-10 - 10,000 flips: Expect streaks of 13-14

Surprising fact: Long streaks happen more often than people expect!

Binomial Distribution

Coin flips follow a binomial distribution: - Mean (expected heads) = n × p - Variance = n × p × (1-p) - Standard deviation = √variance

For a fair coin with n flips: - Expected heads = n/2 - Standard deviation = √(n/4) = √n / 2

Understanding the Statistics

Heads/Tails Count

Total occurrences of each outcome. Should be approximately equal for fair coins with many flips.

Proportion

Percentage of each outcome. Converges to 0.5 (or bias value) as flip count increases.

Longest Streak

Maximum consecutive identical flips observed. Grows logarithmically with total flips.

Alternations

How often the result changes (H→T or T→H). For random flips, expect ~50% alternation rate.

Z-Score

Measures how unusual the result is: - |Z| < 2: Normal (95% of results) - 2 ≤ |Z| < 3: Unusual (5% of results) - |Z| ≥ 3: Very rare (0.3% of results)

Biased Coins

Real coins can be biased due to:

Physical factors: - Weight distribution - Design asymmetry - Wear and damage

Technique: - Catching vs. letting bounce - Starting position - Flip strength

Use the bias slider to explore how unfair coins behave differently.

Applications

Education

  • Teaching basic probability
  • Demonstrating the law of large numbers
  • Explaining the gambler’s fallacy
  • Visualizing random vs. non-random patterns

Games & Sports

  • Fair decision making
  • Determining first move/possession
  • Breaking ties

Statistics

  • Binary random processes
  • Hypothesis testing
  • Monte Carlo simulations

Computer Science

  • Random bit generation
  • Algorithm testing
  • Randomness verification

Famous Examples

The Super Bowl Coin Toss

From 1967-2020: - Heads: 25 times - Tails: 29 times

This is well within normal variation (Z ≈ 0.54).

Hot Hand Fallacy

Basketball fans believe players have “hot hands” - but analysis shows shooting is closer to independent coin flips than people think.

Probability Facts

  1. Probability of k heads in n flips (fair coin):
    • P(k) = C(n,k) × (1/2)^n
    • Where C(n,k) is the binomial coefficient
  2. Expected longest streak in n flips:
    • Approximately log₂(n)
  3. Probability of getting exactly 50% heads (n flips):
    • Decreases as n increases!
    • For n=100: ~8%
    • For n=1000: ~2.5%
  4. Clustering illusion:
    • Humans see patterns in randomness
    • True randomness includes clusters and gaps

Tips for Exploring

  1. Single Flips: Build intuition about streaks and variability
  2. 100 Flips: See how proportion fluctuates
  3. 1,000+ Flips: Observe law of large numbers
  4. Biased Coins: Learn how bias affects long-term behavior
  5. Compare Runs: Multiple simulations show natural variation