Polson–Sokolov Lab · Francis Galton's quincunx, 1873

Galton Board Lab

Each ball hits one peg per row and bounces right with probability p. The bin it lands in counts its right bounces, so the pile builds a binomial distribution. Switch to a mixture coin to see when that pile stops looking like a bell curve.

← All labs

Based on Chapter 1, Probability and Uncertainty, of Polson and Sokolov, Bayes, Artificial Intelligence, and Deep Learning (vsokolov.org/html/_book).

Ball Observed count Expected count (exact) Normal with the same mean and SD
When the Central Limit Theorem fails

A ball that picks one coin for the whole trip

The first two demos use the same coins: coin A (p = 0.7) with probability 0.3 and coin B (p = 0.5) otherwise. Only the moment of choosing the coin differs. Each sets n = 100 and drops 5,000 balls. The third demo spreads the coins apart so two humps show up with only 20 rows.

Why the pile still looks normal at n = 12

The CLT is a statement about large n, and its failure is too. At n = 12 the two coins' piles are centered at 8.4 and 6.0 with SDs of about 1.6 and 1.7, so they overlap almost completely. Their mixture is only slightly wider than a binomial (SD 2.02 instead of 1.72) and has almost no skew (0.02). A normal curve fits it well. The difference grows with n: the centers separate like 0.2n, while each pile's width grows only like √n. Around n = 50 a second hump appears, and by n = 100 the pile clearly has two.

  1. The CLT needs many independent pieces

    K is a sum of n bounces, K = X1 + … + Xn. The classic CLT says this sum looks normal when the Xi are independent with the same distribution. If the coin is picked fresh at each peg, every bounce is an independent Bernoulli(0.56). The mixture collapses to one coin and the bell curve appears.

  2. Per ball, the bounces share a hidden coin

    Given the coin, bounces are independent. Without knowing it, a right bounce is evidence the ball has coin A, which makes the next right bounce more likely. So any two bounces of the same ball are positively correlated, with Cov(Xi, Xj) = Var(p). That correlation never fades, however many pegs there are.

  3. The correlated part of the variance grows like n²

    A sum of n terms has n variances and n(n−1) covariances. With independence the covariances vanish and Var(K) grows like n. Here they add up to n(n−1)·Var(p), which grows like n² and eventually dominates. The inflation factor 1 + (n−1)ρ keeps rising with n.

  4. The average settles on the coin, not on 0.56

    The law of large numbers still works, but inside each ball: K/n converges to that ball's coin, 0.5 or 0.7, never to 0.56. So K/n has a two-point limit, and the standardized K converges to a two-point shape instead of N(0,1). The CLT does hold within each coin, so the pile becomes two bells weighted 70/30. The normal curve with the correct mean and SD still misses both humps.

Law of total variance for K
Var(K) = E[Var(K | p)] + Var(E[K | p])
= n·E[p(1−p)] + n²·Var(p)
For w = 0.3, pA = 0.7, pB = 0.5
p̄ = 0.3·0.7 + 0.7·0.5 = 0.56
Var(p) = w(1−w)(pA−pB)² = 0.0084
ρ = Var(p) / (p̄(1−p̄)) ≈ 0.034
SD of K. The gap from the independent case widens with n.
nPer pegPer ballInflation
121.722.021.38×
503.515.742.67×
1004.9610.44.38×
4009.9337.914.6×
Where K/n ends up as n → ∞
Per peg: K/n → 0.56
Per ball: K/n → 0.7 (prob 0.3) or 0.5 (prob 0.7)

Takeaway for students. Sample size helps only when observations are independent. Students in the same classroom, repeated measurements on the same patient, and households in the same survey cluster all share a hidden "coin". Averaging more of them does not wash that out. This is the reason for random-effects models, cluster-robust standard errors, and the Beta-Binomial model, and the variance inflation 1 + (n−1)ρ is the survey statistician's design effect.

One peg is one coin flip

At every peg the ball goes right with probability p or left with probability 1 − p. Each bounce is a Bernoulli trial, independent of the others.

Xi ~ Bernoulli(p)

One bin is a count of rights

After n rows, the bin number equals the number of right bounces. Many different paths lead to the middle bins, and only one path leads to each edge.

P(K = k) = C(n,k) · pk · (1−p)n−k

Many rows give a bell curve

K is a sum of n independent trials, so by the Central Limit Theorem its shape approaches a normal curve as n grows.

K ≈ Normal(np, √(np(1−p)))

Try this in class

  1. Drop 10 balls one at a time and ask students to predict the next bin. Then add 1,000 and compare the pile to the dashed expected marks.
  2. Set n = 2 or 3. The normal curve fits poorly. Raise n to 30 and watch the fit improve.
  3. Switch to "Mixture, per ball" at n = 12. The pile still looks normal, and only the SD row gives the mixture away. Raise n to 30 and a shoulder appears on the right. At n = 100 there are two clear humps, while the red curve still has one.
  4. Keep n = 100 and flip between "per peg" and "per ball". The mean stays near 56, but the SD jumps from about 5 to about 10.
  5. Move coin B to 0.7 so both coins match. Var(p) becomes 0, ρ becomes 0, and the bell curve comes back.