## Arithmetic billiards

Submitted by Marianne on April 24, 2018Mathematical billiards is an idealisation of what we experience on a regular pool table. In mathematical billiards the ball bounces around according to the same rules as in ordinary billiards, but it has no mass, which means there is no friction. There also aren't any pockets that can swallow the ball. This means that the ball will bounce infinitely many times on the sides of the billiard table and keep going forever.

One fascinating aspect of mathematical billiards is that it gives us a geometrical method to determine the least common multiple and the greatest common divisor of two natural numbers. Have a look at the Geogebra animation below (the play button is in the bottom left corner) and try to figure out how the construction works. If you would like to play the animation again, double click the refresh button in the top right corner. The two natural numbers are 40 and 15 in this case. The least common multiple of 40 and 15 equals 120, and the greatest common divisor is 5.

### The basics

Here is the basic idea. Suppose we are given two positive whole numbers and , neither of which is a multiple of the other (the case where one is a multiple of the other is easy and is left to the reader). For the billiard table we take a rectangle whose sides have lengths and . We shoot a billiard ball from one corner (the bottom left in the figure above) making a 45 degree angle with the sides. The billiard ball bounces off the rectangle’s sides. It does not lose speed and, by the law of reflection, is reflected at a 45 degree angle each time it meets a side (thus the path only makes left or right 90 degree turns). The path of the billiard ball consists of line segments.

We claim that the ball eventually hits a corner and that the *least common multiple* of and is the length of the path the ball has traversed until it hit the corner, divided by . If you decompose the billiard table into *unit squares* (squares of side length one), the least common multiple is equal to the number of unit squares which are crossed by the path.

We also claim that the path crosses itself. The first segment of the path contains the point of self-intersection which is closest to the starting point. The *greatest common divisor* of the two given numbers, we claim, is the distance from the starting point to the closest point of self-intersection, divided by . It is also equal to the number of unit squares crossed by the piece of the path from the starting point to the first point of self-intersection.

### Mirror billiards

While looking at an object in a mirror, you have the impression that the object is behind the mirror. Notice that three points are aligned: the point marking your position, the point on the mirror where you see the reflection of the object and the (imaginary) point behind the mirror where you believe the object to be. To prove our claims above, we are going to exploit this simple idea, the mirror being one side of the billiard table.

The *least common multiple* of and , written as , is the smallest natural number that is a multiple of both and . We can write it as for some positive whole numbers and . For example, if and , then and can be written as

In this case and .

Given our two numbers and , none of which is a multiple of the other, start by forming a square with sides of length . Notice that this can be decomposed into rectangles with sides of length and . That’s because fits into a total of times and fits into a total of times. Because is the *least* common multiple of and our square is the smallest square that can be *tiled* by rectangles with sides of lengths and in this way. We’ll call the bottom left of these rectangles and the top right .

In this example *a*=4 and *b*=6. Their least common multiple is 3x4=2x6=12, so the square has sides of lengths 12. It contains 3x2=6 rectangles.

Now draw the diagonal of the square which starts at the bottom left corner and ends in the top right corner.

From we’ll now create a zig-zag path , which lies entirely within the bottom left rectangle , using repeated reflection. This path will turn out to be the path of an arithmetic billiard ball moving within the rectangle .

We start with the top right square and reflect it in the side that is crossed by the diagonal , which it shares with a neighbouring rectangle (the rectangle below in our example). Let’s write for this rectangle.

Reflecting the square *S* in its bottom side reflects part of the diagonal into the rectangle below *S*.

Now reflect in the other side that is crossed by (its left side in our example), not the one that would get us back to .

Reflecting *S*' in its left side.

Keep going like this, reflecting rectangles across sides crossed by , until you reach the bottom left rectangle . The repeated reflections transform the diagonal into the zig-zag path .

The last reflection results in the path *t* entirely contained in the rectangle *R*.

The path is exactly the path of a ball shot from the bottom left corner of at 45 degree angles to the sides of . You can verify this using the animation below.

To prove that this is really the case, recall that the ball will make 90 degree turns whenever it hits a side of . It’s quite easy to see that the path does the same. This is best explained using a picture:

The path *t* makes 90 degree turns when it meets a side of *R*.

Our path ends at the point that comes from repeatedly reflecting the top right corner of in sides of rectangles, so the end point of is a corner of .

Now the length of is equal to the length of the diagonal . The length of the diagonal of any square is times its side length (this comes from Pythagoras’ theorem). Therefore

where stands for the length of . Rearranging, we have that

which is exactly what we were trying to prove.

Our method worked perfectly for our example, but can we be sure it works for general values of and (that aren’t multiples of each other)? The only thing that could go wrong is that the diagonal of the square meets the corner of a rectangle which lies in the interior of the square. If that were the case, we wouldn’t know which of the two sides that meet at the corner to reflect in.

We’ll show that this can’t happen. It’s quite easy to convince yourself that any point on the diagonal determines a square: simply drop a line down vertically until you hit the bottom edge of the original square, and draw a horizontal line over to the left until you hit the left edge of the original square.

Any point on the diagonal of a square determines a smaller square.

If such a point were also the corner of one of the rectangles, then our small square would be tiled by rectangles with sides of lengths and . But this is impossible: as we noted above, the square with side length is the smallest square that can be tiled in this way.

We’ve shown that is equal to the length of the path divided by . Let’s move on to the unit squares.

### The unit squares crossed by the path

To count the number of unit squares (squares with sides of length ) the path crosses, we equip our rectangle with a coordinate system. The vertical axis runs along the left vertical side of and the horizontal axis runs along the bottom side of . The coordinates of the corners of the unit squares are whole numbers.

The rectangle *R* with its coordinate systems. Coordinates of the corners of unit squares that lie on *t* are shown in red.

It’s clear that if crosses a unit square, it does so along a diagonal. You can also convince yourself that if the corner of any unit square lies on , then its coordinates must add up to an even number. Any unit square only has two corners whose coordinates add up to an even number and these are diagonally opposite each other. Therefore can only pass along one of the two diagonals of a unit square.

We leave it up to you to show that never passes along the diagonal of a unit square twice, neither in the same direction, nor in the opposite direction. You will need to show that the end point of is different from its starting point. To do this, note that at least one of or must be odd, and that the end point of comes from repeatedly reflecting the top right corner of the rectangle .

We now know that never crosses a unit square more than once and always does so along the diagonal. Since the diagonal of a unit square has length , the number of squares crossed by is

just as we claimed above.

### The greatest common divisor

We claimed that the greatest common divisor of and is the distance from the starting point of to the closest point of self-intersection, divided by . It is also equal to the number of unit squares crossed by the piece of the path from the starting point to the first point of self-intersection.

Let’s first assume that . In this case, the least common multiple of and is the product (see if you can prove this for yourself). By our previous result, the number of unit squares crossed by our path is also . Since the sides of the rectangle have lengths and , there are unit squares in total. And since the path crosses no unit square more than once, it must cross all unit squares in this case.

In this example *a*=3 and *b*=8. The greatest common divisor is 1 and the least common multiple is 24.

We already know that the corners of unit squares that lie on all have coordinates that add to an even number. Conversely, the fact that every unit square is crossed by means that every point with coordinates that add to an even number lies on .

This means that the points with coordinates , and and all lie on . This can only happen if is a self-intersection point of .

The point is therefore a point at which intersects itself, and it’s the point closest to along . The distance from to along is . Divide this by and you get , the greatest common divisor of and (by our assumption above). The number of unit squares crossed on the way from to along is also equal to . This proves our original claim for for the case in which .

If , then we can rescale the whole figure by a factor : dividing and by their greatest common divisor, we obtain two positive integers whose greatest common divisor is . We can repeat the construction from above for these two integers, and then scale the picture up by multiplying each axis in our coordinate system by . Unit squares then become squares of side length . All geometric properties not related to the length (the shape of the path, in which corner the billiard ball lands, etc...) are unaffected by the rescaling.

In this example *a*=9 and *b*=24. The greatest common divisor is 3. Dividing through by 3, we get 3 and 8, the numbers used in the example above. Scaling up the picture from the previous example by a factor of 3 then gives us this picture. The unit squares from the previous picture turn into larger squares of side length 3, made up of 3x3=9 unit squares each.

It then follows that the self-intersection point closest to the starting point lies on the first segment of the path at distance from the starting corner and that is the number of unit squares crossed by the first segment of the path from the starting point to the closest point of self-intersection.

### Questions for the reader

If you enjoyed this article, then here are some questions you might want to explore yourself:

- If one of the two given numbers is a multiple of the other, what is the shape of the arithmetic billiard path?
- For which numbers does the arithmetic billiard path end in the corner opposite to the starting point?
- What are the symmetries of the arithmetic billiard path (as a geometrical figure)?

### About the author

Antonella Perucca is Professor for Mathematics and its Didactics at the University of Luxembourg. She is a researcher in number theory and invents mathematical exhibits (for example the "Chinese Remainder Clock"). To find out more, explore her webpage. She would like to thank Andrew Bruce for help with the article.