# The simplest billiards problem

The Problem:

Let's say we have a rectangle of size $m \times n$ centered at the origin (or, if it makes the math easier, you can place it wherever on the plane). We take a billiard ball, represented by a point, in the center of the rectangle with a constant velocity vector $\vec{v}$. Assuming no other forces acting on the ball, write a function $f(m,n,t)$ that gives the position of the ball after $t$ seconds.

My Work: I don't actually know all that much vector math (this is a junior high pre-calc class), so I tried to set this up as a geometry problem. With the constraints above, if we expand our velocity vector $\vec{v}=\langle a,b\rangle$, our problem is as shown:

Let's call the angle the vector makes with the x-axis $\theta$. Making a triangle with our vector and the x-axis, we get that $\tan(\theta)=\frac{b}{a}$. So, $\theta=\arctan(\frac{b}{a})$.

Now, if we want to find the vector pointing to where the ball is going to hit the boundary of the rectangle $\vec{h}$, we know it is going to be the same direction as $\vec{v}$, just a different magnitude. Mathematically put: $$\frac{1}{||v||}\vec{v}=\frac{1}{||h||}\vec{h}$$

We can calculate the magnitude of $\vec{h}$ by noticing that $$\sin(\theta)=\sin(\arctan(\frac ba))=\frac{\frac{m}{2}}{||h||}$$ Which simplifies quite nicely to: $$||h||=\frac{m \sqrt{a^2 + b^2}}{2 b}$$ Returning to our original equation, we can re-arrange to get that $\frac{||h||}{||v||}\vec{v}=\vec{h}$. Since the magnitude of $\vec{v}$ is $\sqrt{a^2+b^2}$, this, astoundingly, simplifies to $\vec{h}=\frac{m}{2b}\vec{v}$, leading me to believe there was a way easier way to do what I did. So, we found the first point that the ball will "bounce" at. But I have no idea how to model the ball "reflecting" and then to calculate where it will bounce again and again.

This was extra credit on an exam, and I didn't have time for it during the exam but it still interests me. Any help?

• The collision will change the sign of 1 of the components of the velocity vector: if it hits the left or the right wall, it will change the $x$, and it will change the $y$ otherwise. – Botond May 23 '18 at 22:01
• Notice that motion on a rectangular billiard is equivalent to motion on a torus. – zar May 23 '18 at 22:21
• One (non) cheat. Imagine an infinite table. Where does the ball end then. Consider how many vertical tables it passed through. Find out the x value mod table width. If it passed through an number of tables take the negative of that. Do the same for the vertical. – fleablood May 23 '18 at 22:43

## 2 Answers

Consider the following: When the (straight-line) trajectory leaves through the top edge, $f(m,n,t)$ must reflect in the $y$ direction through the line $y=m/2$, and similarly when it passes through any of the other edges. That is, we may think of the straight-line trajectory $g(t)=[at,bt]$, and find $f(m,n,t)=[h_n(at),h_m(bt)],$ where $h_{k}(x)$ is a $2k$-periodic function always mapping into $[-k/2,k/2]$, linear on each segment, and such that for small $x,$ $h_{k}(k/2-x)=h_{k}(k/2+x)$, $h_{k}(-k/2-x)=h_{k}(-k/2+x)$. Then the function we need is given by $$h_{k}(x)=\begin{cases}x&\text{if }-k/2<x\leq k/2,\\ k-x&\text{if }k/2<x\leq 3k/2,\end{cases}$$ and extended by $2k$-periodicity so that $h_{k}(x+2kn)=h_{k}(x)$ for all $n\in\mathbb{Z}$.

That is, $f(m,n,t)=[h_{n}(at),h_{m}(bt)]$ with $h_{k}$ defined for any $k>0$ as above. Note that it is just as easy to solve in the case that we start at some point $[c,d]$, because we have already dispensed with the "hard part," which are the reflections. Then in this case, we just have $f(m,n,t)=[h_{n}(c+at),h_{m}(d+bt)]$.

Hint:

The pink ball is the one bouncing off the walls. Now imagine a "ghost" green ball that can pass through walls but otherwise has the same speed and direction.