Richard Pates
Researcher interested in control theory, electrical power systems and mathematics.

Playing Pool with Pi — and Möbius Transforms

Can pi be approximated by counting the collisions between a pair of blocks sliding along a plane? Amazingly, yes!

The setting for this post is the following puzzle, due to Gregory Galperin and popularised by Grant Sanderson in the following video:

In the puzzle, initially a large block with mass \(M\) is sliding towards a stationary small block with mass \(m\). They collide, after which the small block collides into a wall. This causes the small block to change direction and collide with the large block again. This process repeats until eventually the large block starts sliding away too quickly to be caught again by the small block. Amazingly, if the ratio of the two masses equals \(10^{2r}\), then the total number of collisions that occur equals \(\lfloor10^r\pi\rfloor\). That is the number of collisions equals the first \(r+1\) digits of \(\pi\).

In this post we will show how the theory of iterated Möbius transforms can be used to solve this puzzle. Though certainly not the simplest approach, it does provide some nice insights, and serves to introduce some of the amazing theory behind the Möbius transform that I have been using in my research. In the past I have used them to study fundamental performance limitations in networks of dynamical systems, as well as how to design control systems for autonomous vehicles, with plenty more to come. But now, on with the solution.

Describing collisions

In order to describe the effect of the collisions, we will use the following compact notation


In the above, \(V_b\) and \(V_a\) denote the velocity of the big block before and after the collision, with \(v_b\) and \(v_a\) describing the velocity of the small block in a similar fashion. The ‘collision matrix’ \(C\) describes how these velocities change during a collision, of which we have two types:

Type 1: The simplest type of collision to describe is when the small block hits the wall, and reverses direction. Using the notion of eq. (1), this corresponds to


Type 2: We also have to describe how the velocities change when two blocks collide. Applying conservation of momentum and energy shows that this collision is described by


We can now find the velocities of the blocks after multiple collisions by simply multiplying these matrices together. For example, the velocities after the first four collisions in the puzzle are given by


Collisions as Möbius transforms

We will now understand the effect of the sequence of collisions on the velocities of the blocks using Möbius transforms! The following video sets the scene.

Short introduction to the Möbius Transform created by Douglas Arnold and Jonathan Rogness of the University of Minnesota.

The key idea is that the effect of multiplying a velocity vector by a collision matrix, just as in eq. (1), corresponds to mapping a point through a Möbius transform. This allows us to understand and visualise the effect of a sequence of collisions through a sequence of simple transformations of the Riemann sphere. In fact, a consequence of conservation of energy is that the transformations associated with \(C_{\vert\!\leftarrow{}}\) and \(C_{\leftrightarrow{}}\) are extremely simple — they are pure rotations.

This connection hinges on the projective matrix representation of the Möbius transform. This shows that multiplying the velocity vector by the collision matrix is equivalent (less a scaling factor) to mapping the point \(V/v\) through a Möbius transform. We will actually consider the action of the transform on the scaled point \(\sqrt{M}V/\sqrt{m}v\). This means that the Möbius transform associated with a given collision matrix is given by


The beauty of this technique is its simplicity and generality. Though for our problem we only need to understand two specific type of collision, this technique extends seamlessly to other types of collision, even those occurring in 2D rather than 1D (just allow the velocities and entries of \(C\) to be complex numbers!). Replacing the collision matrix with other types of dynamical object also allows the same tools to be applied in a host of other settings, including control theory as in my research.

We now describe the specific Möbius transforms for the two types of collision.

Type 1: We see that




When viewed on the Riemann sphere this corresponds to a rotation about the vertical axis by 180°.

When viewed as projections on the Riemann sphere, the transformation \(\mathcal{M}_{C_{\vert\leftarrow{}}}(z)\) rotates points about the vertical axis by 180°.

Type 2: This time the calculations are a bit more involved. However a little perseverance (or Wolfram Alpha) shows that

\[\begin{bmatrix}\sqrt{M}&0\\0&\sqrt{m}\end{bmatrix}C_{\leftrightarrow{}}\begin{bmatrix}\sqrt{M}&0\\0&\sqrt{m}\end{bmatrix}^{-1}=\underbrace{\begin{bmatrix}\cos\theta&\sin\theta\\-\sin\theta&\cos\theta\end{bmatrix}}_{\text{Rot. 3}}\underbrace{\begin{bmatrix}1&0\\0&-1\end{bmatrix}}_{\text{Rot. 2}}\underbrace{\begin{bmatrix}\cos\theta&-\sin\theta\\\sin\theta&\cos\theta\end{bmatrix}}_{\text{Rot. 1}},\]

where \(\sin\theta=\sqrt{m/(m+M)}\). This shows that \(\mathcal{M}_{C_{\leftrightarrow{}}}\) consists of the composition of three rotations. The first corresponds to a rotation of \(2\theta\) about an axis parallel to the imaginary axis as shown below.

The first part of the transformation \(\mathcal{M}_{C_{\vert\leftarrow{}}}(z)\) rotates points by an angle of \(2\theta\) about an axis parallel to the imaginary axis.

The second rotation is exactly the type 1 transformation that we saw before, and the third is the inverse of the first (a rotation by \(-2\theta\)). Putting this together we see that the second type of collision corresponds to the following rotation.

The transformation \(\mathcal{M}_{C_{\leftrightarrow{}}}(z)\) is given by the composition of 3 rotations.

Sequences of Collisions: The power of the Möbius transform is realised when considering sequences of collisions. Suppose we want to see how velocities change as a result of two consecutive collisions. After projecting the initial velocities onto the sphere, all that needs to be done is apply the two rotations, one after the other (the two collisions). This is illustrated from a side on view below for a type 2 collision followed by a type 1 collision. Note in particular that these transformations have the effect of rotating the original point to some new point separated from the first by an integer multiple of \(2\theta\).

When viewed from the side, the effect of a collision between the blocks followed by a collision with the wall corresponds to rotating the velocity point by an angle of \(4\theta\).

The final collision

We are now almost in a position to solve the puzzle, and have all the tools we need to understand how the velocities change as the blocks collide. The only thing that remains is to find the stopping condition, after which no more collisions can occur.

The blocks will stop colliding when both blocks are no longer moving to the left, and the large block is moving at least as fast as the small block. That is, when \(V_a\leq{}v_a\leq{}0\). In fact, since the blocks cannot cross through each other, this can only occur if


Projecting this region onto the sphere shows that the blocks will stop colliding when the projected point enters the red region below. Observe that the similar triangles show that this region sweeps out an arc length of \(2\theta\).

The right triangles with the marked angles are all similar.

The solution to the puzzle

At the start, the large block is moving to the left with some initial velocity, say \(V_i\). We therefore need to count the number of collisions that occur before the velocities


satisfy the stopping condition.

When projected onto the Riemann sphere, the initial velocity corresponds to the point at the north pole. To help us count the number of collisions, it is instructive to consider two special cases.

The first is when the final collision occurs between the small block and the wall, after which the small block and the large block are moving to the right with exactly the same speed. When written in terms of the angle \(\theta\) (which varies depending on the ratio between the masses), this corresponds to the case that \(\pi/\theta\) is an odd number.

The second special case is when the ratio between the masses is picked so that the final collision happens between the two blocks, after which the small block is perfectly stationary. This corresponds to the case that \(\pi/\theta\) is an even number.

This nice thing about these cases is that the number of collisions is easy to count, and equals \(\pi/\theta-1\). This is illustrated below.

The sequence of collisions when the integer is odd and even. Note that in the even case, every point is visited twice, even \(P\) (there is a collision between the blocks in which \(V/v\mapsto{}(-V)/(-v))\).

We will now consider the general case using a continuity argument. The idea is that by continuously increasing the mass of the big block, we can transform any case into one of the special cases without changing the number of collisions between the blocks. Since we know how to count the collisions for the special cases, we can use this to deduce the number of collisions in the general case too.

To illustrate this, suppose that


where \(\pi/\overline{\theta}\) and \(\pi/\underline{\theta}\) are consecutive integers. We see that we can transform the two simple cases into each other by varying \(\theta\) over this interval.

By varying \(\theta\), the two simple cases can be continuously transformed into each other.

By moving \(\theta\) towards \(\underline{\theta}\) (this corresponds to increasing \(M\)), we see that the finishing point moves continuously through the stopping region without the number of collisions changing (this will only change when \(\theta\) moves through \(\underline{\theta}\)). From this it follows that the number of collisions for \(\theta\) must be the same as for \(\underline{\theta}\), or equivalently,


Since \[\sin\theta=\sqrt{m/(m+M)}\Longrightarrow{}\tan\theta=\sqrt{m/M},\]

it follows that


At this point the result is clear. If \(M/m=10^{2r}\), then (since the approximation in the above is very good ) the digits of \(\frac{\pi}{\theta}\) up to the decimal point will equal those of \(\pi{}10^r\). We can make this a little more precise using error estimates in Taylor approximations. In particular, since for angles \(0\leq{}\phi\leq{}1\)


we find that


Therefore unless the \(r-2\) digits after the decimal point of \(\pi{}10^{r}\) all happen to be 9’s, \(N_{\text{collisions}}=\lfloor{}\pi{}10^{r}\rfloor\). Since the positions of the first occurrence of a string of 1, 2, 3, 4, 5, 6, 7, 8, and 9 consecutive 9’s in the decimal expansion of \(\pi\) are at 5, 44, 762, 762, 762, 762, 1,722,776, 36,356,642 and 564,665,206 respectively, this is guaranteed up to astronomical values of \(r\)!