Model notes
A wall, two blocks, and a strange count
This simulator is inspired by 3Blue1Brown's video "Why colliding blocks compute pi". I found the idea fascinating: a classical mechanics toy with no visible circle in the setup can still make pi appear, simply by counting the clacks. I wanted to make that idea explorable rather than just watched.
The model is deliberately idealised. A unit-mass block sits between a rigid wall and a larger incoming block. Both slide on a frictionless one-dimensional track, every collision is perfectly elastic, and the counter increments for wall impacts and block-block impacts.
The setup
The wall is at x = 0. The small block has mass m = 1 and starts between the wall and the large block. The large block has mass M = 10n, starts to the right, and moves left. The visible block sizes are symbolic so that very large mass ratios remain usable on screen.
Why this is surprising
There is no circle drawn on the track, but the velocity state can be transformed into a scaled plane where kinetic energy is a circle. In that transformed view, collisions act like reflections. The number of reflections before both blocks escape to the right is tied to how many angular steps fit into a half-turn.
What the simulator demonstrates
- Momentum and kinetic energy conservation during block-block collisions.
- Velocity reversal when the small block hits the rigid wall.
- A finite collision sequence ending when no future collision is possible.
- The special decimal cases M = 1, 100, 10,000, and 1,000,000.
What this model omits
It omits friction, deformation, finite contact time, sound propagation, air resistance, relativity, and real-world problems caused by nearly simultaneous contacts. Browser floating-point arithmetic also limits extreme mass ratios. This is not a practical pi-computation machine; it is an educational demonstration of an exact ideal model.
Historical context
The result is commonly called Galperin billiards, after Gregory Galperin's "Playing Pool with Pi" result. 3Blue1Brown's presentation made the argument widely accessible and is the direct inspiration for this lab.
References and further reading
Article last reviewed for factual accuracy on 27 June 2026.