The binomial distribution in this visualization
Repeat a yes-or-no trial times, independently and with the same chance of “yes” each time. The number of yeses then has the binomial distribution: for . On the Galton board each row of pegs is one trial and a turn to the right is a yes, so the bin a ball lands in counts its right turns. The outlined bars are the exact probabilities; the balls you drop fill them in as frequencies.
Where do the two factors come from? A ball that ends in bin turned right times and left times, in some order. Because the turns are independent and never changes, every such path has the same probability, one factor per peg: . The number of such paths is the number of ways to choose which of the rows are right turns, ; counted peg by peg, each peg is reached from the two above it, which is how Pascal’s triangle adds up. Without those conditions the product need not give a path’s probability. Dealing cards without replacement is the common case: the chance that the next card is a heart depends on the cards already dealt, so the number of hearts in a hand follows a hypergeometric distribution, not a binomial one.
Why is the bin with the most paths not always the most likely? Take . The middle of the board has the most paths, but when each of them is less likely than a path with more of the likelier turn. Split into factors shows the tug of war on a log scale, where the product becomes a sum: the path counts form an arch, one path’s chance is a straight line of slope , and the line tilts the arch. Neighbouring bins give the peak exactly: , which exceeds 1 while . So the most likely count is ; when is a whole number, it ties with the bin just below.
What are the mean and the spread? Score each yes as 1 and each no as 0; then is the sum of scores, each with mean and variance . Means always add, and for independent trials so do variances: has mean and standard deviation . For a fixed the spread is widest at and shrinks toward zero as approaches 0 or 1; at the endpoints every trial gives the same answer. After a run the readout puts the balls’ mean and standard deviation beside these values; they vary from run to run, because the balls are a sample. Once is no longer small the bars look like a bell, and the central limit theorem says why.
Things to notice
- A yellow bar above or below its outline is not an error: a run is a sample. A bin that expects about 200 balls typically misses by a dozen or so; as balls add up the bars settle toward the outlines, though any one bar can drift away for a while.
Controls
- Drag across the bins, or the ▲ under them, to choose a bin; click it or press Enter to light its paths one at a time. Above 400 paths, only a sample of 400 lights up. Afterwards each segment’s width shows the share of the bin’s paths that use it.
- The first five balls fall slowly: at each peg a random number sends the ball right when . Press the key again to pause; the balls already in the bins stay.