↑ ↓ to move · enter to open

006 · Chance · Simulation

probability

One random event tells you almost nothing. Thousands of them settle on a number you can predict exactly. Three experiments where chance converges: a game-show puzzle that fooled mathematicians, a way to estimate π by dropping needles, and a board of pegs that builds a bell curve.

LAB 1

the monty hall problem

A car is behind one door and goats are behind the rest. You pick a door. The host, who knows where the car is, opens every other door except one, always showing goats. Should you stick with your door or switch? When Marilyn vos Savant answered "switch" in 1990, thousands of readers wrote in to say she was wrong. She was right.

  • your pick
  • opened by the host
  • the car's door
  • host revealed the car (game thrown out)
Doors
Host

Your games0 played

StrategyPlayedWonWin rate

Why switching wins

Your first pick is right with probability 1/3. The host's reveal can't change that, because he can always find goats to show. Switching wins exactly when your first pick was wrong, which happens 2/3 of the time.

With 50 doors it's obvious: you picked one at random, the host opened 48 goats, and one other door is left standing.

The answer rests on the host's rules: he always opens the goat doors and offers the switch, whatever you picked, and when you happen to hold the car he chooses at random which door stays shut. Change the rules and the answer changes. A host who only offers a switch when you picked the car makes switching always lose. A host who opens doors at random and happens to show only goats makes it a 50/50.

simulated games

How to read this: solid lines are the running win rate; dashed lines are where the math says they should end up.

  • always switch
  • always stick
—
Always switch
—
Always stick
0
Games simulated (same games, both strategies)

Law of large numbers

Early on the lines swing wildly. A short streak can make sticking look better. As games pile up, both rates close in on their true values. Each simulated game is played in full, host included, and scored for both strategies. The dashed lines show the theory: .

LAB 2

buffon's needle

Drop needles of length ℓ on a floor ruled with lines d apart. The chance a needle crosses a line is 2ℓ / (π d). Count the crossings and rearrange to estimate π. Georges-Louis Leclerc, Comte de Buffon, posed the question in 1733, making it the first problem in geometric probability.

0 needles
0.80

How to read this: each stroke is a dropped needle. Count the amber ones: the share that crosses a line is what turns into π.

  • needle touches a line
  • needle misses
  • floorboard edges

Try this: press Drop 10,000 and watch the estimate tighten.

—
Estimate of π
—
Error
0
Needles
0
Crossings

Estimate vs. needleslog scale

  • your running estimate
  • the true π

Where π comes from

P(cross) = 2ℓ / (π d) ⇒ π ≈ 2ℓ · n / (d · crossings)

A needle crosses when its center is close enough to a line for its tilt to reach it. Averaging that tilt over every angle brings in a factor of π. Convergence is slow: each extra correct digit needs about 100 times more needles.

In 1901 Mario Lazzarini claimed 3,408 drops gave π ≈ 355/113, correct to six decimals. That's far too lucky, and he almost certainly stopped at the count that gave the answer he wanted.

LAB 3

the galton board

Each ball bounces left or right at every peg, at random. No single path is predictable, but the pile at the bottom always takes the same shape. The number of paths into each bin is a row of Pascal's triangle, and with enough rows it becomes the bell curve.

0 balls
12 0.50

How to read this: each ball goes left or right at every peg. Green bars are where balls landed, and the gold line is the prediction. In the readouts, the gold "/ x" after Mean and Spread is the predicted value.

  • ball in flight
  • balls landed
  • predicted pile
0
Balls landed
—
Mean bin
—
Spread (σ)

Theorybinomial

The gold outline is the exact prediction, C(n, k)·pᵏ(1−p)ⁿ⁻ᵏ times the number of balls. Its C(n, k) are the same counts as in Pascal's triangle, one path per way to choose which bounces go right.

Central limit theorem

Add up many small, independent random nudges and the total is approximately normal, whatever each nudge looks like on its own. Tilt the board with the right-bounce slider: the pile shifts and narrows, but it stays bell-shaped. That's why heights, measurement errors and test scores so often follow the curve.