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

\[\begin{bmatrix}V_a\\v_a\end{bmatrix}=C\begin{bmatrix}V_b\\v_b\end{bmatrix}.\qquad\qquad(1)\]

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

\[C_{\vert\!\leftarrow{}}=\begin{bmatrix}1&0\\0&-1\end{bmatrix}.\]

**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

\[C_{\leftrightarrow{}}=\frac{1}{M+m}\begin{bmatrix}M-m&2m\\2M&m-M\end{bmatrix}.\]

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

\[\begin{bmatrix}V_a\\v_a\end{bmatrix}=C_{\vert\!\leftarrow{}}C_{\leftrightarrow{}}C_{\vert\!\leftarrow{}}C_{\leftrightarrow{}}\begin{bmatrix}V_b\\v_b\end{bmatrix}.\]

#### 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.

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

\[\mathcal{M}_C(z)=\frac{az+b}{cz+d},\,\begin{bmatrix}a&b\\c&d\end{bmatrix}=\begin{bmatrix}\sqrt{M}&0\\0&\sqrt{m}\end{bmatrix}C\begin{bmatrix}\sqrt{M}&0\\0&\sqrt{m}\end{bmatrix}^{-1}.\]

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

\[\begin{bmatrix}\sqrt{M}&0\\0&\sqrt{m}\end{bmatrix}\begin{bmatrix}1&0\\0&-1\end{bmatrix}\begin{bmatrix}\sqrt{M}&0\\0&\sqrt{m}\end{bmatrix}^{-1}=\begin{bmatrix}1&0\\0&-1\end{bmatrix}.\]

Therefore

\[\mathcal{M}_{C_{\vert\leftarrow{}}}(z)=-z.\]

When viewed on the Riemann sphere this corresponds to a rotation 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 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.

**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\).

#### 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

\[V_a/v_a\geq1.\]

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 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

\[\begin{bmatrix}V_a\\v_a\end{bmatrix}=\ldots{}C_{\leftrightarrow{}}C_{\vert\!\leftarrow{}}C_{\leftrightarrow{}}\begin{bmatrix}V_i\\0\end{bmatrix}\]

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.

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

\[\underline{\theta}<\theta<\overline{\theta},\]

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 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,

\[N_{\text{collisions}}=\left\lfloor{}\frac{\pi}{\theta}\right\rfloor{}.\]

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

it follows that

\[\frac{\pi}{\theta}=\frac{\pi}{\arctan\sqrt{m/M}}\approx{}\pi\sqrt{\frac{M}{m}}.\]

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\)

\[\arctan{\phi}=\phi-R(\phi),\,0\leq{}R(\phi)\leq{}\frac{1}{3}\phi^3,\]

we find that

\[\pi{}10^r\leq{}\frac{\pi}{\arctan{10^{-r}}}\leq{}\pi{}10^r+10^{-r+1}.\]

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\)!