# Arithmetic billiards

In recreational mathematics, arithmetic billiards provide a geometrical method to determine the least common multiple (LCM) and the greatest common divisor (GCD) of two natural numbers. It makes use of reflections inside a rectangle that has sides with length of the two given numbers. This is a simple example of trajectory analysis used in dynamical billiards.
Arithmetic billiards can be used to show how two numbers interact. Drawing squares within the rectangle of length and width of the two natural numbers allows a reader to learn more about the relationship between the two numbers. Coprime integers interact with every unit square within the rectangle.

## Properties

Arithmetic billiards is a name given to the process of finding both the LCM and the GCD of two integers using a geometric method. It is named for its similarity to the movement of a billiard ball.
To create an arithmetic billiard, a rectangle is drawn with a base of the larger number, and height of the smaller number. Beginning in the bottom-left corner at 45° angle, a path is drawn until it hits a side of the rectangle. Every time that the path meets the rectangle's side, it reflects with the same angle (the path makes either a left or a right 90° turn). Eventually (i.e., after a finite number of reflections) the path hits a corner and there it stops.
When the lines cross each other, the path becomes a zigzag consisting of one or more segments. Else, the path has self-intersections and consists of segments of various lengths in two orthogonal directions. In general, the path is the intersection of the rectangle with a grid of squares (oriented at 45° with respect to the rectangle's sides).

## Features

For the rectangle, shaped similar to a billiard table, we give $a$ and $b$ as the side lengths. This can be divided into $a\cdot b$ unit squares. The least common multiple $\operatorname {lcm} (a,b)$ is the number of unit squares crossed by the arithmetic billiard path or, equivalently, the length of the path divided by ${\sqrt {2}}$.
Suppose that none of the two side lengths divide the other. Then the first segment of the arithmetic billiard path contains the point of self-intersection that is closest to the starting point. The greatest common divisor $\gcd(a,b)$ is the number of unit squares crossed by the first segment of the path up to that point of self-intersection. The path goes through each unit square if and only if $a$ and $b$ are coprime integers—they have a GCD of 1.
The number of bouncing points for the arithmetic billiard path on the two sides of length $a$ equals $(a/\operatorname {gcd} (a,b))-1$, and similarly $(b/\operatorname {gcd} (a,b))-1$ for the two sides of length $b$. In particular, if $a$ and $b$ are coprime, then the total number of contact points between the path and the perimeter of the rectangle (i.e., the bouncing points plus starting and ending corner) equals $a+b$.
The ending corner of the path is opposite the starting corner if and only if $a$ and $b$ are exactly divisible by the same power of two (for example, if they are both odd), else it is one of the two adjacent corners, according to whether $a$ or $b$ has more factors than $2$ in its prime factorisation. The path is symmetric if the starting and the ending corner are opposite. The path is point symmetric in conjunction with the center of the rectangle, else it is symmetric with respect to the bisector of the side connecting the starting and the ending corner.
The contact points between the arithmetic billiard path and the rectangle perimeter are evenly distributed: the distance along the perimeter (i.e., possibly going around the corner) between two such neighbouring points equals $2\gcd(a,b)$. Setting coordinates in the rectangle such that the starting point is $(0,0)$ and the opposite corner is $(a,b)$ means that any point on the arithmetic billiard path with integer coordinates has the property that the sum of the coordinates is even (the parity cannot change by moving along diagonals of unit squares). The points of self-intersection of the path, the bouncing points, and the starting and ending corner are exactly the points in the rectangle whose coordinates are multiples of $\gcd(a,b)$ and are such that the sum of the coordinates is an even multiple of $\gcd(a,b)$.

## Proof

There are a few ways to show a proof of arithmetic billiards.
Consider a square with side $\operatorname {lcm} (a,b)$. By displaying multiple copies of the original rectangle (with mirror symmetry), the arithmetic billiard path can be visualised as a diagonal of that square. In other words, one can think of reflecting the rectangle rather than the path segments.
It is convenient to rescale the rectangle dividing $a$ and $b$ by their greatest common divisor, an operation that does not alter the path's geometry (e.g., the number of bouncing points).
The motion of the path is “time reversible”, meaning that, if the path is currently traversing one particular unit square (in a particular direction), then there is absolutely no doubt from which unit square and from which direction it originated.

### One generalisation

If one allows the starting point of the path to be any point in the rectangle with integer coordinates, then there are also periodic paths, unless the rectangle sides are coprime. The length of any periodic path equals $2\operatorname {lcm} (a,b)\cdot {\sqrt {2}}$.

## Usage

Both Hugo Steinhaus and Martin Gardner have discussed arithmetic billiards as mathematical puzzles. Teachers sometimes use arithmetic billiards to show GCD and LCM. They are sometimes referred to by the name 'Paper Pool' due to a common version of billiards called pool. They have been used as a source of questions in mathematical circles.