
Calculating π with Collisions
This is easily my favorite way to compute the digits of π. It’s simple, elegant, unexpected, and hilariously inefficient. Consider two boxes of mass m₁ and m₂ sitting on a frictionless surface in front of a wall, as shown below.
When box 2 is given some initial velocity to the left, it will inevitably collide with box 1. When two objects collide, we can safely assume that total momentum is conserved through the collision. Here, we imagine that the two boxes collide elastically, meaning that the total kinetic energy is conserved as well. If the two boxes have the same mass, this results in a perfect exchange of velocities between the boxes. Click anywhere in the window below to start the simulation and see this happen.
Pay close attention to the total number of collisions that occur before the two boxes part ways forever. As you may expect, increasing the mass of either of the boxes results in a greater number of collisions that occur before the boxes part ways. The simulation below is modified so that box 2 has a mass that is five times that of box 1. Give it a click.
Let’s ramp things up a bit. Check out what happens if one of the boxes has a mass that is one hundred times greater than the other:
At this point you may be starting to see where this is headed. Next, we’ll see what happens when we increase the mass of box 2 by yet another factor of one hundred. I had to slow down this simulation substantially to be able to capture all the collisions that occur in a very short amount of time. Check it out:
At this point if you’re not stroking your chin in confused amazement and disbelief, then I don’t know what to tell you. What you’re noticing is correct: every 100-fold increase in the mass of box 2 gives us an extra digit of π in the total number of collisions. How on Earth does this work? Why does it work? Where even is the circle in this system? It’s one-dimensional after all. And why is π counting something? Stay tuned for a post that will answer all of these questions and more.
Credit to Grant Sanderson for the inspiration, and Gregory Galperin for the original idea and proof.