The calculation of the number pi has been pursued for thousands of years, using both geometric and infinite series techniques. For example, the Leibniz series for pi is 4 times the infinite series (1 – 1/3 + 1/5 – 1/7 + 1/9 …). Since the advent of modern computers, pi has now been calculated to as many as 31.4 trillion digits [1]. However, there are also mechanical methods to calculate pi, one of the earliest being the method of Georges Louis Leclerc Comte de Buffon [2], in which a needle of length L/2 is dropped at random many times onto a grid of parallel lines a distance L apart; for a large number of trials, the fraction of times the needle intersects a line is approximately 1/pi.

More recently, in 2003, Gregory Galperin showed that two masses colliding with each other and with a fixed wall may be used to calculate pi to any desired accuracy if the collisions are elastic, i.e., no energy is lost to friction [3]. In his construction, a large mass collides with a small mass at rest. The masses are constrained to move in one dimension, so that when the smaller mass then hits the wall, it bounces back and hits the larger mass again. This process continues until the larger mass reverses direction and is moving away from the smaller mass faster than the smaller mass is moving, and there are no more collisions. If the ratio of the masses is 100 raised to the kth power, then pi is approximately the number of collisions (between the masses and between the small mass and the wall combined) divided by 10 raised to the kth power. For example, if the ratio of the masses is 10,000:1, there will be 314 total collisions and the approximation for pi is 3.14.

One key to this remarkable situation is that the elasticity of the collisions ensures that the total energy is conserved (more on this later). However, when the smaller mass rebounds off the fixed wall — which is being treated as an immovable object that has infinite mass — total momentum is not conserved. An infinitely massive wall is not physically possible, and it is a fundamental law of physics that momentum is conserved. I wondered if you could come up with a process to calculate pi that did not require a fixed wall and therefore would also conserve momentum.

I found such a process. Start with three masses constrained to move in one dimension and colliding elastically, with the mass on the left moving and the other two initially at rest (see diagram below). Let the first and third masses be equal and much larger than the middle mass; then the number of collisions N in this situation will also lead to a good approximation of pi.

Three masses colliding

In this case, if r is the ratio of the masses, pi will be given approximately by N times the square root of 2/r. For example, if the ratio r is 20,000:1, then there will again be 314 collisions and pi is approximately 3.14. It is interesting that with two large masses the mass ratio has to be twice as much as in the situation with one large mass and a wall.

Why are conservation of energy and momentum somehow related to pi? Conservation of energy can be written as a quadratic equation in the three velocities, which defines an ellipsoid in the three-dimensional velocity space – sort of like a football, even more like an Australian rules football that is more rounded at the ends. Conservation of momentum is an equation linear in the velocities, which defines a flat plane in velocity space. The system is constrained to lie on the intersection of these two surfaces, which is an ellipse. By stretching the coordinates appropriately, the ellipse can be changed into a circle. The remarkable thing is that each collision advances you by a set amount around this circle, and for very large r you have to go almost exactly halfway around the circle to reach the point where the masses no longer collide with each other. And, of course, halfway around a circle is pi radians, so the number of collisions leads to a good approximation for pi when r is very large.

Can you come up with other scenarios to approximate pi, perhaps with more masses? Maybe so, but it is much trickier. In the two cases above, the smaller mass is always bouncing between a large mass and either a wall or another large mass. The order of the collisions is always the same – the smaller mass always alternates colliding with something on its left and something on its right, regardless of the exact initial positions. With more masses, the first mass hits the second, which hits the third, but whether the next collision is the second mass hitting the first again or the third mass hitting the fourth mass will depend on the relative initial positions as well as the mass ratios. I’m content with sticking with the three-mass solution.

An appropriate song, especially at the 0:16 mark.

[1] See the article by E. Haruka Iwao, β€œPi in the sky: Calculating a record-breaking 31.4 trillion digits of Archimedes’ constantβ€œ on Google Cloud, https://cloud.google.com/blog/products/compute/calculating-31-4-trillion-digits-of-archimedes-constant-on-google-cloud .

[2] G.L.L. Comte de Buffon, ”Sur lej eu de franc-carreau” (1777). That this gives an approximation to pi can be proved using calculus.

[3] G. Galperin, Rational and Chaotic Dynamics, Vol. 8, No. 4, 2003, p. 375. A nice discussion of this situation can be found at https://www.youtube.com/watch?v=jsYwFizhncE .