How to use it
A Galton board, also called a bean machine or quincunx, is a board with rows of pegs arranged in a triangle. Balls are dropped in at the top, bounce left or right at every peg and finally land in bins at the bottom. Press Start and balls fall one after another. Each bounce is a random left or right choice, and the bins slowly fill into a bell-shaped column chart. The motion on screen is an animation along the peg lattice, not a rigid-body physics simulation. What is real is the chance at every peg, drawn with a pseudo-random number generator.
Try the default first: ten rows and p = 0.5. After a few hundred balls the tallest columns sit in the middle.
Controls
- Start / Pause (or Space) starts a steady stream of balls or freezes the animation. Reset clears everything and stops the stream.
- Drop 1 and Drop 100 send animated balls. Drop 1000 instantly skips the animation and fills the bins at once.
- Rows of pegs runs from 1 to 20, so there are 2 to 21 bins. p is the chance of going right at a peg, from 0.05 to 0.95. Changing either one restarts the count.
- Ball rate and animation speed set how fast balls are released and fall.
- Show toggles the binomial outline bars, the normal curve and the Paths overlay. Tap a bin, or use the list, to highlight the path of the latest ball that landed there.
- The columns rescale as counts grow; the line under the buttons says how many balls the full chart height stands for.
How it works
Sir Francis Galton described this device in his book Natural Inheritance (1889) to show how many small independent influences add up to a bell shape. At every peg a ball goes right with probability p and left with probability 1 − p, independently of all other pegs. After n rows the bin number k is simply the number of right turns, so k follows the binomial distribution B(n, p):
The number C(n, k) = n! / (k! (n − k)!) counts the different left/right sequences that end in bin k. These numbers form Pascal’s triangle: 1, 6, 15, 20, 15, 6, 1 for six rows. Each peg’s number is the sum of the two above it, because a ball can arrive from either. Switch on Paths to see them. With p = 0.5 every sequence is equally likely, so the middle bins, which have the most paths, collect the most balls.
The mean bin is np and the variance is np(1 − p); the standard deviation is its square root. For large n the binomial distribution is close to the normal distribution with the same mean and standard deviation. This is the de Moivre–Laplace theorem, a special case of the central limit theorem. The green curve is the normal density times the number of balls, i.e. the expected balls per bin of width 1. In a normal distribution about 68% of values lie within one standard deviation of the mean, about 95% within two and about 99.7% within three (the 68–95–99.7 rule).
When p is not 0.5 the whole peak moves towards np. With few rows the shape is also skewed: for p below 0.5 the mean sits near the left wall and the long tail points right. More rows make the shape more symmetric again. Real boards are only approximately binomial: a ball’s speed and spin carry over from peg to peg, pegs are never identical and balls collide, so bounces are not perfectly independent. This page assumes ideal independent choices.
The small chart shows the law of large numbers: the largest gap between observed and expected bin percentages falls roughly like 1/√N as more balls drop.
Things to try
- Set 1 row and p = 0.5: two bins, each holding about half of the balls.
- Set 2 rows and press Drop 1 repeatedly. The sequences LL, LR, RL and RR give bins 0, 1, 1 and 2, so the middle bin gets about half of the balls.
- Set 12 rows and p = 0.3. The expected mean is 12 × 0.3 = 3.6, so the peak moves left and the right side has the longer tail.
- Compare 10 balls with 10,000 balls (press Drop 1000 instantly ten times). Few balls look ragged, many hug the curve.
- Use 20 rows and about 10,000 balls and check that roughly 68% land within one standard deviation of the mean.
Frequently asked questions
Why is the middle the tallest?
More left/right sequences end in the middle. With 10 rows only one reaches bin 0, but 252 reach bin 5.
Is the normal curve an exact fit?
No. The binomial is discrete and limited to bins 0 to n, while the normal curve is continuous and unlimited. The fit improves with more rows and is best when p is near 0.5.
Why do the columns still differ from the theory after many balls?
Counts are random. A bin with probability P(k) typically misses its expected count by about the square root of N · P(k) · (1 − P(k)) balls. That grows more slowly than N, so the percentages approach the theory.
Is this real physics?
No. The balls follow a smooth arc between pegs for display, while each left or right decision is drawn at random. A physical board also has friction, spin and collisions.