Lesson goal: The Galton Board & Bell Curve

Previous: The inclined plane and friction | Home | Next: Newton's cradle and momentum

In 1889, Victorian polymath Sir Francis Galton invented an ingenious physical apparatus called the Galton Board (or quincunx) to demonstrate the Central Limit Theorem and how microscopic random events produce macroscopic mathematical order.

Small balls are dropped through a top funnel onto a triangular lattice of staggered pegs:
  • At every peg, a ball hits the pin and has an equal $50\%$ chance of deflecting to the left ($L$) or right ($R$).
  • If a ball passes through $N$ rows of pegs, the number of rightward bounces $k$ follows the Binomial Distribution: $$P(X = k) = \binom{N}{k} \left(\frac{1}{2}\right)^k \left(\frac{1}{2}\right)^{N-k} = \frac{\binom{N}{k}}{2^N}$$ where $\binom{N}{k} = \frac{N!}{k!(N-k)!}$ is the binomial coefficient from Pascal's Triangle!

From Pascal's Triangle to the Bell Curve

As balls accumulate into vertical collection bins at the bottom, their column heights physically trace out the classic Gaussian normal distribution (the Bell Curve): $$f(x) = \frac{1}{\sigma \sqrt{2\pi}} e^{-\frac{(x - \mu)^2}{2\sigma^2}}$$ The center bin receives the most balls because there are far more paths to the center than to the outer edges!

To build the Galton board in code:
  • add_floor() creates the bottom foundation.
  • add_ramp(x, y, w, h, angle, color) places angled ramps for the top funnel.
  • add_peg(x, y, radius, restitution, color) places fixed circular deflection pins.
  • add_box(x, y, w, h, is_static, angle, color) places vertical collection dividers.
  • add_ball(x, y, radius, restitution, color) drops a physics ball.
add_floor()
for row = 1, 6 do
for col = 1, row do
add_peg(320 - (row - 1)*14 + (col - 1)*28, 80 + row * 24, 4)
end
end

for i = 1, 30 do
add_ball(316 + (i % 3) * 4, 30 - i * 12, 5, 0.4, "#38bdf8")
end
Move the mouse over a dotted box for more information.

  • Pascal's Triangle Paths: For $N = 6$ peg rows, the number of paths to each bin corresponds to row 6 of Pascal's triangle: $$\mathbf{1 \quad 6 \quad 15 \quad 20 \quad 15 \quad 6 \quad 1}$$ There are $2^6 = 64$ total possible paths. The center bin has 20 paths, while the outermost bins have only 1 path each!
  • Binomial Probabilities:
    • Center bin ($k = 3$): $20 / 64 \approx 31.25\%$
    • Adjacent bins ($k = 2, 4$): $15 / 64 \approx 23.44\%$ each
    • Near edges ($k = 1, 5$): $6 / 64 \approx 9.38\%$ each
    • Far edges ($k = 0, 6$): $1 / 64 \approx 1.56\%$ each
  • Physics Engine: Matter.js simulates every individual circle collision and rebound in real time!

Now you try. Run the code and watch the physical column heights emerge in the collection bins.

Type your code here:


See your results here: