Billiard Bouncing in Polygons

This is billiards:

The sides of the square are mirrors, and we're bouncing a beam of light off them. (Or, if you like, we're ricocheting a never-slowing billiard ball off the walls.) Billiards problems have fascinating internal structure with connections to most of mathematics and physics, and some simple questions about it have been open for centuries.

The basic question of billiards is: will a particular path continue forever in a unique pattern, or will it eventually loop back on itself? If it loops back, how long does it take?

Look for cycles in the square above by trying to line the path up with your starting point. (If you're having trouble lining it up exactly, hold down shift to slow down your turning.) There are a few different solutions (the exact number depends on when we consider two paths “different,” e.g. is a horizontal cycle the same as a vertical cycle since it's just a simple rotation). Once you find one cycle, though, press Q / E to slide sideways, and you will get a whole range of similar cycles. But we consider paths that only differ by moving sideways to be basically the same.

The number of solutions goes up if we extend the path length. For example, here's the equilateral triangle with the path length extended by a factor of 20:

You can find a lot more different cycles now. As you spin around, they will flash by as the “mostly-empty” spots where the path mostly overlaps itself, leaving larger gaps that show the white background. In fact they might flash by too fast -- hold down both shift and control to slow down rotation even more.

There are more different paths now, but even when there isn't an obvious cycle, we can still see patterns: the intersections formed by the path make what looks like a repeating visual pattern along the whole triangle, even when the endpoint doesn't loop back to where we started.

One reason for this is that no matter which angle you start at, there will always be exactly six different angles in the resulting bounces (why?). This suggests, accurately in this case, that there aren't just a lot of cycles, but that the cyclic paths almost entirely cover the surface. (They are dense on the surface, meaning that no matter what the starting position and angle are, there are cycles passing infinitely close by -- they just might be very long.)

This is a little easier to see on the square, where there are even fewer possibilities:

Because horizontal and vertical bounces are orthogonal, they don't interfere with each other, so no matter your starting angle, the whole path will have at most 4 different angles (and since they come in opposite-facing pairs, that means only 2 overall line slopes). So every cycle ultimately splits up into diamond patterns, like the one this example starts on. You'll also find a lot of loops that converge exactly to one of the corners. We usually disqualify those ones because the mirror doesn't have a unique angle at those points, although sometimes we can still say interesting things about them.

If you try to find all the cycles in this example, you'll probably get the idea that they are basically determined by how many times the path hits each wall. For example, the starting position hit the top / bottom 3 times and the left / right 5 times. We might try to find a cycle for each combination of horizontal and vertical bounces. Some of these aren't possible, though: try to find a cycle that hits each wall exactly three times. Why doesn't it work? How can we tell which combinations are possible and which aren't?

These are questions we can find good answers to (try it!). But the only reason it's possible is because the sides don't affect each other. Even on the equilateral triangle, it gets more complicated, with paths hitting six different angles instead of four. (Does a regular $n$-gon always produce $2n$ different angles? Why [not]?) And that's still one of the easiest. To get an idea of the difficulties with more general shapes, try it on an irregular triangle:

Things are much less clear now, and not just because the path extends further. Is there a cycle? It's hard to tell. You almost certainly won't find one without at least holding down shift and ctrl and moving around.

In this particular case, though, there is (at least) one. Is that true for every triangle? Probably, but the question is open. And except for some very symmetric cases, general polygons are even less well understood.