PhysSandbox
Classical MechanicsWaves & SoundElectricity & MagnetismOptics & LightGravity & OrbitsLabsLessons
🌙Astronomy & The Sky🌡️Thermodynamics🌍Biophysics, Fluids & Geoscience📐Math Visualization🔧Engineering🧪Chemistry📊Statistics & Probability
ENRUESPTFRDE

Related simulators

Continue with similar topics in this category — or all 10 in Statistics & Probability.

View category →
NewFeaturedKids

Central Limit Theorem

Launch Simulator

Pick a parent (uniform, exponential, binomial, die), draw samples of size n = 1, 5, 30; the histogram of means turns normal and its spread shrinks as σ/√n.

NewKids

Binomial Distribution

Launch Simulator

P(K = k) bars for n trials with success p; mean np, variance np(1−p); coin and rare-event presets; normal overlay at large n.

NewKids

Normal Distribution & z-Scores

Launch Simulator

Bell curve with μ and σ; shaded tails, the 68–95–99.7 rule, and a built-in z-score converter x → z = (x − μ)/σ.

NewKids

Law of Large Numbers

Launch Simulator

Coin or die: running mean x̄ₙ for several runs converges to μ; the ±σ/√n envelope shows how slowly.

NewKids

Pearson Correlation

Launch Simulator

Scatter cloud with adjustable r, covariance ellipse, and a parabola preset where r ≈ 0 despite a perfect relationship.

NewSchool

Type I & II Errors and Statistical Power

Launch Simulator

Two normal curves (H₀ and H₁), a decision threshold; α, β and power 1−β as shaded areas; effect size, σ and n sliders.

PhysSandbox

Interactive physics, chemistry, and engineering simulators for students, teachers, and curious minds.

Physics

  • Classical Mechanics
  • Waves & Sound
  • Electricity & Magnetism

Science

  • Optics & Light
  • Gravity & Orbits
  • Astronomy & The Sky

More

  • Thermodynamics
  • Biophysics, Fluids & Geoscience
  • Math Visualization
  • Engineering
  • Chemistry
  • Statistics & Probability

© 2026 PhysSandbox. Free interactive science simulators.

PrivacyTermsContact
Home/Statistics & Probability/Galton Board (Bean Machine)

Galton Board (Bean Machine)

Balls bounce left/right through rows of pegs; the bins fill a binomial that turns into a bell curve. Few rows vs many rows.

Board

12
0.5
20 balls/s

Overlays

Each ball is an independent sequence of n Bernoulli trials: at every peg it moves right with probability p, so its bin index is the number of right bounces and follows B(n, p) exactly. At most 150 balls are animated at once; the rest are dropped straight into the bins from the same seeded random stream. Both overlays are scaled to the number of balls already in the bins. Changing n or p empties the board; Reset also reseeds the generator.

Shortcuts

  • •Space / Enter — drop 100 balls
  • •P — stream play / pause
  • •R — reset (new seed)

Measured values

Balls in bins N0
Balls in flight0
Rows n12
p (right)0.50
Expected mean np6.00
Expected SD √(np(1−p))1.732
Empirical mean of bin index—
Empirical SD of bin index—
Fraction in the fullest bin—

About this model

The simulator models Galton's bean machine (quincunx): a ball released at the top of a triangular array of n rows of pegs meets exactly one peg per row and is deflected one half-step to the right with probability p or to the left with probability 1 − p. Deflections are independent of each other and of everything that happened before, so a ball's path is a sequence of n Bernoulli trials. If k of the n bounces go right, the ball ends up k half-steps right of the n − k left bounces, i.e. in bin number k counted from the left, with k = 0, 1, …, n. The number of balls in bin k is therefore binomially distributed: with N balls the expected count is N · C(n, k) pᵏ (1 − p)ⁿ⁻ᵏ, the mean bin index is np and its standard deviation is √(np(1 − p)). The yellow markers draw exactly this expectation, computed from log-factorials; the pink curve is the normal density N(np, np(1 − p)) multiplied by N (bin width 1), which is the de Moivre–Laplace approximation of the binomial. Both overlays are rescaled to the number of balls currently in the bins so that the comparison with the histogram is fair at every moment. The readouts give the sample mean and (population) standard deviation of the landed bin indices next to the theoretical np and √(np(1 − p)), and the fraction of balls in the fullest bin, which shrinks towards the largest binomial probability as n grows. Simplifications: balls do not collide with each other, peg shape and ball size play no role, every bounce is an ideal weighted coin, and the animation only shows up to 150 balls while the rest are added to the bins instantly; all random decisions come from a single seeded generator so a run can be repeated after Reset within a session. Setting p ≠ 0.5 shows how a biased board skews the pile and how the normal approximation deteriorates when np or n(1 − p) is small. Companion simulators: statistics/binomial-distribution for the probability mass function on its own, statistics/normal-distribution for the bell curve and z-scores, statistics/central-limit-theorem for sums of many independent steps in general, and statistics/law-of-large-numbers for how the empirical mean settles at np.

Who it's for: Lower-secondary to introductory college statistics and probability (ages 13+), as a first visual encounter with the binomial distribution and its normal limit.

Key terms

  • Bernoulli trial
  • binomial distribution
  • expected value np
  • standard deviation √(np(1−p))
  • normal approximation
  • de Moivre–Laplace theorem
  • independence
  • histogram

How it works

A ball dropped into a Galton board meets one peg per row and bounces right with probability p or left with probability 1 − p, independently at every peg. After n rows the ball lands in bin k, where k is simply the number of right bounces, so the bin counts follow the binomial distribution B(n, p) with mean np and standard deviation √(np(1 − p)). With many rows the staircase of bins is well described by the normal curve N(np, np(1 − p)) — a hands-on picture of the de Moivre–Laplace theorem. The simulation ignores ball–ball collisions and peg geometry: every bounce is an ideal coin flip drawn from a seeded random generator.

Key equations

P(K = k) = C(n, k) · pᵏ · (1 − p)ⁿ⁻ᵏ, k = number of right bounces = bin index
E[K] = n p, SD(K) = √(n p (1 − p))
large n: expected count in bin k ≈ N · φ((k − np)/σ) / σ, σ = √(np(1 − p))

Frequently asked questions

Why does the number of the bin equal the number of right bounces?
Every bounce moves the ball half a bin width to the left or to the right. After n bounces with k to the right and n − k to the left, the net displacement is (k − (n − k))/2 = k − n/2 bin widths from the centre. Numbering the leftmost bin 0 (all bounces left) turns that displacement into bin index k. So the bin a ball lands in is just a count of successes in n independent trials, which is exactly the definition of a binomial random variable.
Why is the pile widest in the middle and not flat?
There is only one path to the far-left bin (left, left, left, …) but many paths to the central bins: the number of paths to bin k is the binomial coefficient C(n, k), which is largest near k = n/2. With a fair board (p = 0.5) every single path is equally likely, so the bin probabilities are proportional to C(n, k) — Pascal's triangle. With a biased board the paths are no longer equally likely and the most probable bin moves to about np.
How many rows are needed before the normal curve fits?
The binomial is close to N(np, np(1 − p)) when both np and n(1 − p) are reasonably large; a common rule of thumb is both at least 5 to 10. For p = 0.5 twelve rows already give a good fit, while for p = 0.1 you need many rows because the distribution is squeezed against bin 0 and remains visibly skewed. The simulator lets you test this directly: pick p = 0.2 with 4 rows and then with 20 rows and compare the pink curve with the yellow markers.
Why does the measured standard deviation not grow in proportion to the number of rows?
Each bounce adds an independent step whose variance is p(1 − p). Variances of independent steps add, so after n rows the variance is np(1 − p) and the standard deviation is √(np(1 − p)). Doubling the rows therefore multiplies the spread by only √2 ≈ 1.41, not by 2. Relative to the full width of the board (n + 1 bins) the pile actually becomes narrower as n grows, which is one way of seeing the law of large numbers.