Mathematical 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 $a$ and $b$, 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 $a$ and $b$. 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 $a$ and $b$ is the length of the path the ball has traversed until it hit the corner, divided by $\sqrt{2}$. 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 $\sqrt{2}$. 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 $a$ and $b$, written as $lcm(a,b)$, is the smallest natural number that is a multiple of both $a$ and $b$. We can write it as $ma=nb$ for some positive whole numbers $m$ and $n$. For example, if $a=4$ and $b=6$, then $lcm(a,b)=12$ and can be written as $$12 = 3\times 4 = 2 \times 6.$$ In this case $m=3$ and $n=2$. Given our two numbers $a$ and $b$, none of which is a multiple of the other, start by forming a square with sides of length $lcm(a,b)$. Notice that this can be decomposed into $m\times n$ rectangles with sides of length $a$ and $b$. That's because $a$ fits into $lcm(a,b)$ a total of $m$ times and $b$ fits into $lcm(a,b)$ a total of $n$ times. Because $ma=nb$ is the

*least*common multiple of $a$ and $b$ our square is the smallest square that can be

*tiled*by rectangles with sides of lengths $a$ and $b$ in this way. We'll call the bottom left of these rectangles $R$ and the top right $S$.

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.

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

Reflecting *S*' in its left side.

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

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

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

### The unit squares crossed by the path

To count the number of unit squares (squares with sides of length $1$) the path $t$ crosses, we equip our rectangle $R$ with a coordinate system. The vertical axis runs along the left vertical side of $R$ and the horizontal axis runs along the bottom side of $R$. 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.

We leave it up to you to show that $t$ 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 $t$ is different from its starting point. To do this, note that at least one of $m$ or $n$ must be odd, and that the end point of $t$ comes from repeatedly reflecting the top right corner of the rectangle $S$.

We now know that $t$ never crosses a unit square more than once and always does so along the diagonal. Since the diagonal of a unit square has length $\sqrt{2}$, the number of squares crossed by $t$ is $$\frac{|t|}{\sqrt{2}} = \frac{\sqrt{2} lcm(a,b)}{\sqrt{2}} = lcm(a,b),$$ just as we claimed above.### The greatest common divisor

We claimed that the greatest common divisor of $a$ and $b$ $gcd(a,b)$ is the distance from the starting point of $t$ to the closest point of self-intersection, divided by $\sqrt{2}$. 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 $gcd(a,b)=1$. In this case, the least common multiple of $a$ and $b$ is the product $ab$ (see if you can prove this for yourself). By our previous result, the number of unit squares crossed by our path is also $ab$. Since the sides of the rectangle $R$ have lengths $a$ and $b$, there are $ab$ unit squares in total. And since the path crosses no unit square more than once, it must cross all $ab$ 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.

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.

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

## Comments

## Thanks for the article

Thank you for the interesting story about these nice interpretations of gcd and lcm and the pictures! It is also surprising that this algorithm can be used for constructing an optical physical system to find gcd.

## MATHEMATICS TEACHER

EXCELLENT ARTICLE TO EXPLORE NUMBER