Playing Pool with Pi – Part 2 – Two Blocks, One Wall, and a Very Silly Way to Compute π

I want to tell you about the strangest place I have ever seen π show up.

Here’s the setup. You have a frictionless floor. There’s a wall on the left. Next to the wall sits a small block of mass $m$, just sitting there. Coming in from the right is a big block of mass $M$, sliding left.

Everything is perfectly elastic. The blocks don’t lose energy when they hit each other. The small block doesn’t lose energy when it hits the wall. Nothing heats up, nothing squishes.

So: big block hits small block. Small block goes flying into the wall. Bounces off. Comes back and hits the big block. Which slows the big block down a little. And so on, clack clack clack, until eventually the big block has been turned around completely and is sliding away to the right faster than the small block can chase it.

How many clacks do you hear? (Counting both kinds: block-on-block, and block-on-wall.)

Here’s the answer:

$M/m$number of collisions
13
10031
10,000314
1,000,0003141
100,000,00031415
10,000,000,000314159

Yeah. It’s π.

There is no circle anywhere in this problem. Nothing spins. Nothing is curved. It’s two rectangles sliding in a straight line. And yet if you make the big block $100^N$ times heavier than the small one, the number of clacks gives you the first $N+1$ digits of π.

The first time I saw this I assumed it was a trick, or a coincidence that breaks down at some point. It isn’t. It’s real, it’s exact, and the reason why is honestly beautiful.

The credit goes to Gregory Galperin, who wrote it up in 2003 in a paper called Playing Pool with π. Grant Sanderson (3Blue1Brown) made it famous with a video. What I want to do here is walk through the whole thing carefully, and then spend extra time on the part that I think gets rushed: why does a circle show up at all? That question turns out to have a much better answer than “it just does.”


First, let’s be clear about what we’re computing

The idealizations, all in one place:

  • No friction, no air resistance.
  • All collisions perfectly elastic.
  • The wall is infinitely heavy, so the small block bounces off it at the same speed and the wall doesn’t move.
  • No relativity. (At a mass ratio of $10^{10}$ this is getting pretty silly, but it’s a physics puzzle, not an experiment.)

Call the big block’s velocity $v_1$ and the small one’s $v_2$, with rightward being positive. We start with $v_1 = -v_0$ and $v_2 = 0$.

The clacking stops when both blocks are moving right and the big one is at least as fast as the small one:

$$v_2 \ge 0 \quad \text{and} \quad v_1 \ge v_2.$$

The first condition means the small block won’t reach the wall again. The second means the big block won’t get caught.

You could just grind this out. Apply the elastic collision formula, flip a sign for the wall, repeat, check the stopping condition each time. A computer will happily do it. But if you do that, you get a pile of numbers and zero insight. Nothing in that pile whispers “π.”

So let’s do something else.


The trick: turn the whole system into a single dot

Here’s the move that makes everything work.

At any instant, this system is completely described by two numbers: $v_1$ and $v_2$. That’s it. So draw a plane. Put $v_1$ on the horizontal axis and $v_2$ on the vertical. Now the entire state of the system is one point on that plane, and the story of the collisions is that point hopping around.

This is called a phase space, and the reason it’s powerful is simple: it turns a question about motion into a question about shapes. Shapes are easier.

What do our conservation laws look like on this plane?

Energy is conserved all the time, including at the wall:

$$\tfrac12 M v_1^2 + \tfrac12 m v_2^2 = E.$$

That’s an ellipse. A very squashed one, if $M \gg m$.

Momentum is conserved only when the two blocks hit each other. (When the small block hits the wall, momentum goes into the wall, and the wall is infinite, so it just absorbs it.)

$$M v_1 + m v_2 = p.$$

That’s a straight line with slope $-M/m$.

So we’ve got a squashed ellipse and some lines. It’s progress, but the ellipse is annoying. Two different axes, factors of $M$ and $m$ cluttering everything up. And no π in sight.


Why the circle? (This is the good part)

Here’s where the standard explanation says something like: “since we’re hunting for π, let’s rescale the axes to turn the ellipse into a circle.” Which sounds like cheating. Like we decided the answer and then bent the picture to fit.

It isn’t cheating. Let me explain why the circle was there the whole time and we just weren’t looking properly.

Kinetic energy is secretly a ruler

Look at the energy expression again:

$$E = \tfrac12\left(M v_1^2 + m v_2^2\right).$$

Compare that to the Pythagorean theorem, $\text{length}^2 = a^2 + b^2$. It’s the same shape of expression, except the two terms are weighted by the masses.

That’s not a coincidence. In mechanics, the kinetic energy of a system defines a notion of distance on the space of velocities. Physicists call this the kinetic energy metric. In plain terms: the masses tell you what “length” means in this space.

When we drew the naive $(v_1, v_2)$ plane, we were measuring with an ordinary ruler, one that knows nothing about the blocks. Of course the natural circle looked like a squashed ellipse. We were using the wrong ruler.

So use the right one

Define:

$$x = \sqrt{M},v_1, \qquad y = \sqrt{m},v_2.$$

Now energy conservation reads

$$x^2 + y^2 = 2E.$$

A circle. Radius $\sqrt{2E}$.

I want to be clear about what just happened. We did not stretch an ellipse into a circle. We changed which ruler we measure with, and with the system’s own ruler, the set of “all states with the same energy” is exactly a set of points at the same distance from the origin. Which is what a circle is.

And those coordinates aren’t arbitrary either. $\sqrt{M}v_1$ is the big block’s momentum divided by $\sqrt{M}$, or if you prefer, the square root of its kinetic energy (with a sign). It’s a natural quantity.

The payoff: collisions become mirror bounces

This is where the new coordinates really earn their keep. Rewrite momentum conservation:

$$M v_1 + m v_2 = \sqrt{M},x + \sqrt{m},y = p.$$

That’s a dot product:

$$\begin{pmatrix} \sqrt{M} \ \sqrt{m}\end{pmatrix} \cdot \begin{pmatrix} x \ y\end{pmatrix} = p.$$

So momentum is just the shadow our state point casts on the fixed direction $\mathbf{n} = (\sqrt{M}, \sqrt{m})$.

Now put the two laws side by side for a block-on-block collision:

  • Energy says: the point stays the same distance from the origin.
  • Momentum says: the point keeps the same shadow on $\mathbf{n}$.

There is exactly one non-trivial way to do both: reflect the point across the line through the origin pointing along $\mathbf{n}$.

That’s it. That’s the whole content of an elastic collision. Not a formula, a mirror.

Call that mirror line $\ell_1$, and call its angle above the horizontal $\theta$. Since it points along $(\sqrt M, \sqrt m)$:

$$\tan\theta = \frac{\sqrt m}{\sqrt M}, \qquad \boxed{\ \theta = \arctan\sqrt{\tfrac{m}{M}}\ }$$

(If you want to check this against the textbook formula, do it. Take $v_1′ = \frac{(M-m)v_1 + 2mv_2}{M+m}$ and $v_2′ = \frac{(m-M)v_2+2Mv_1}{M+m}$, substitute $x = \sqrt M v_1$, $y = \sqrt m v_2$, and you’ll get the matrix $\begin{pmatrix} c & s \ s & -c\end{pmatrix}$ with $c = \frac{M-m}{M+m}$, $s = \frac{2\sqrt{Mm}}{M+m}$. Note $c^2 + s^2 = 1$, so it’s a reflection matrix, and the half-angle formula gives $\tan\theta = \sqrt{m/M}$. All that ugly algebra collapses into one mirror.)

And the wall is a mirror too

When the small block hits the wall, $v_2 \to -v_2$, so $y \to -y$. That’s a reflection across the horizontal axis. Call that mirror $\ell_0$.

So here is the entire physics problem, restated:

A point sits on a circle. It gets reflected, over and over, alternating between two mirrors that pass through the center: the horizontal one, and one tilted at angle $\theta$.

And now you can already smell the π. Because two reflections in a row make a rotation, by twice the angle between the mirrors. A system that keeps reflecting is a system that keeps rotating. And once you’re going around in circles, π owns you.


Where does it stop?

Translate the stopping condition into the new coordinates.

$v_2 \ge 0$ becomes $y \ge 0$. And $v_1 \ge v_2$ becomes $\frac{x}{\sqrt M} \ge \frac{y}{\sqrt m}$, which in terms of the polar angle $\varphi$ says $\tan\varphi \le \sqrt{m/M} = \tan\theta$.

Put together:

$$\text{end zone} = {\ 0 \le \varphi \le \theta\ }$$

That’s a thin wedge, and here’s the nice part: it’s exactly the wedge between the two mirrors. “The blocks can never touch again” and “the point has landed in the sliver between the mirrors and has nowhere left to go” turn out to be the same statement.


Counting the clacks

The pretty way

Start at $\varphi = \pi$ (big block moving left, small one still, so $x < 0$, $y = 0$: the leftmost point of the circle).

Each collision hops the point to a new spot on the circle, along a chord. Block-on-block hops go along chords perpendicular to $\mathbf n$; wall hops go along vertical chords. Draw a bunch of them and stare.

You’ll notice: all the arcs between consecutive points look equal.

That’s the inscribed angle theorem doing its thing. If you take three points on a circle, the angle at the middle one is half the central angle of the arc cut off by the outer two. Take three consecutive hop points: the angle at the middle is exactly $\theta$, the angle between our two mirrors. So the arc it spans is $2\theta$.

And since all the block-collision chords are parallel to each other, and all the wall chords are parallel to each other, this works at every single step.

Every collision moves the point $2\theta$ radians around the circle.

The same thing, in mirror language

If you’d rather just compute: reflecting across the horizontal mirror sends $\varphi \mapsto -\varphi$, and reflecting across $\ell_1$ sends $\varphi \mapsto 2\theta – \varphi$. Starting at $\pi$ and alternating:

$$\pi,\quad 2\theta – \pi,\quad \pi – 2\theta,\quad 4\theta – \pi,\quad \pi – 4\theta,\ \dots$$

Every two collisions, the point has rotated by $2\theta$. Which is exactly “two reflections make a rotation.” And every one collision moves it $2\theta$ along the circle. Same answer, no geometry theorem needed.

So: how many hops fit?

The point starts at $\pi$ and marches around in steps of $2\theta$. It has to stop before it wraps all the way around, because wrapping around means overlapping an arc it already covered, which means it’s in the end zone. So the number of collisions $N$ is the biggest integer with

$$N \cdot 2\theta < 2\pi, \qquad \text{i.e.} \qquad N\theta < \pi.$$

$$\boxed{\ N = \text{largest integer with } N\theta < \pi \ = \left\lceil \frac{\pi}{\theta}\right\rceil – 1\ }$$

A small gotcha. You’ll often see this written as $\lfloor \pi/\theta \rfloor$. That’s right whenever $\pi/\theta$ isn’t a whole number, which is basically always. But it fails in the simplest case of all.

Take $M = m$. Then $\theta = \arctan 1 = \pi/4$, so $\pi/\theta = 4$, and the floor function says 4 collisions. But count them by hand: equal masses swap velocities, so (1) big hits small, big stops and small flies left at $v_0$; (2) small hits wall, now moving right at $v_0$; (3) small hits big, they swap again, big moves right at $v_0$ and small stops. Done. Three collisions.

Geometrically, the point lands right on the edge of the end zone at $\varphi = 0$, and the “fourth mirror” sits at exactly $\pi$ where it can never be reached. So $\lceil \pi/\theta \rceil – 1$ is the version that’s always right. It’s uglier. Sorry.


And finally, the digits

Last step. We have

$$\theta = \arctan\sqrt{\tfrac{m}{M}}.$$

Set $M/m = 100^N$. Then $\sqrt{m/M} = 10^{-N}$, so $\theta = \arctan(10^{-N})$.

Now, for small $u$:

$$\arctan u = u – \frac{u^3}{3} + \dots$$

The error is cubic. That’s the thing that makes this whole miracle work. $\arctan(0.001)$ differs from $0.001$ by about $3 \times 10^{-10}$, which is nothing.

So $\theta \approx 10^{-N}$, and

$$\frac{\pi}{\theta} \approx \pi \cdot 10^N + \frac{\pi}{3}\cdot 10^{-N}.$$

That correction term is far too small to change the answer. Which leaves

$$N_{\text{collisions}} = \left\lfloor \pi \cdot 10^N \right\rfloor.$$

And $\lfloor \pi \cdot 10^N \rfloor$ is, by definition, the first $N+1$ digits of π. That’s not a discovery about π, that’s just what “digits” means.

$M/m$$\theta$$\pi/\theta$clacks
10.78539824.0000003
1000.099668731.5217431
$10^4$0.0099997314.1697314
$10^6$0.000999999973141.5943141
$10^8$0.000009999999931415.9331415

Why powers of 100, specifically? Because what actually sets the angle is the square root of the mass ratio. And $\sqrt{100^N} = 10^N$. The square root converts base-100 into base-10. And where did that square root come from? From way back in the rescaling step, $x = \sqrt{M}v_1$. It’s been quietly setting up this punchline the whole time.

The one thing that could break it

That tiny error term, $\frac{\pi}{3}\cdot 10^{-N}$, could only cause trouble if $\pi \cdot 10^N$ happened to land extremely close to a whole number. Which would mean: after the first $N+1$ digits, π has a run of about $N$ consecutive 9s.

Galperin flagged this in his paper and left it as a conjecture. In practice it’s fine. In the first hundred million digits of π, the longest run of 9s is eight. To break the count at $N = 8$ you’d need fifty million of them.

But proving it never happens is genuinely hard. It’s tangled up with whether π is a normal number, meaning its digits behave like a random sequence, which nobody has proved.

So: the correctness of this π-computing machine currently rests on an open problem in number theory. I find that delightful.


There’s a second solution, and it’s about light

Quick detour, because Galperin’s original approach was different and it’s lovely.

Instead of tracking velocities, track positions. Let $d_1$ be the distance from the wall to the big block, and $d_2$ the distance from the wall to the small block. Plot the point $(d_1, d_2)$.

The blocks collide when $d_1 = d_2$, which is a diagonal line. The small block hits the wall along a horizontal line. So our point lives in a wedge and bounces off the two edges. Like light between two angled mirrors!

Except the reflection law doesn’t hold. Angle in doesn’t equal angle out.

Fix: rescale the coordinates. $x = \sqrt{M}d_1$, $y = \sqrt{m}d_2$. Yes, the same rescaling. And now:

  • Energy conservation means the point moves at constant speed. A constant speed of light.
  • Momentum conservation means angle in equals angle out. An actual reflection law.

Two laws of mechanics turning into two laws of optics. And the diagonal boundary now has slope $\sqrt{m/M}$, so the angle between the mirrors is, once again, $\theta = \arctan\sqrt{m/M}$.

Then comes the trick that makes it all easy. Instead of bouncing the light, let the light go straight and flip the world each time. The beam now travels in a straight line through a fan of reflected copies of the universe, each one $\theta$ apart. How many copies does it pass through? However many fit in a half turn, which is $\pi$ radians. Same formula, $\lceil \pi/\theta\rceil – 1$.

Two completely different routes, same destination. And notice: both of them needed the $\sqrt{\text{mass}}$ rescaling first. That’s not a coincidence. The kinetic energy metric is the real geometry of this system, and you can’t get anywhere without it.


What actually happened here

Step back and look at what we did. We used no physics beyond two conservation laws you learn in high school. Everything else was geometry:

  1. Squash the whole system into one point. Suddenly a process in time becomes a path in space.
  2. Measure with the system’s own ruler. Kinetic energy tells you what length means here. Use it, and the ellipse was always a circle.
  3. Recognize the move. “Preserves length, preserves one shadow” means reflection. An elastic collision is a mirror.
  4. Use the structure. Two mirrors make a rotation. A circle only has $2\pi$ of room. Divide.

So where does π come from? From conservation of energy. Energy is a sum of squares, a sum of squares gives you a circle, and circles come with π attached. Grant Sanderson put it well: conservation of energy plants the circular seed that eventually blossoms into the π at the end.

As an algorithm for computing π this is spectacularly useless. To get 20 digits you’d need a mass ratio of $10^{38}$ and about $10^{20}$ collisions, most of them in one instantaneous burst. That’s not the point.

The point is that changing where you look can turn an intractable mess into three lines of geometry. That same instinct runs through phase portraits, integrable systems, symplectic geometry, chaos theory — anywhere people study things that change over time.

Alan Kay said it best: a change of perspective is worth 80 IQ points.


If you want to read more

  • G. Galperin, “Playing Pool with π (The Number π from a Billiard Point of View)”, Regular and Chaotic Dynamics 8(4), 2003. The original. Has the unfolding solution and the normality conjecture in sections 9 and 10.
  • 3Blue1Brown, three videos: The most unexpected answer to a counting puzzle, Why colliding blocks compute pi (2025 remake), and How colliding blocks act like a beam of light…to compute pi. Written versions are on his site.
  • A. R. Brown, “Playing Pool with |ψ⟩: from Bouncing Billiards to Quantum Search”, Quantum 4 (2020) 357. Shows this bouncing-block system is exactly isomorphic to Grover’s quantum search algorithm. Those two reflections we kept composing? That’s a Grover iteration. This deserves its own post and I might write one.
  • Aretxabaleta et al., “The Dynamics of Digits: Calculating Pi with Galperin’s Billiards”, Mathematics 8(4) (2020) 509. Good on the history and the finer details.