In the next post we are going to develop an AI which can play pool against an opponent; in order to do that, we first need to establish the mathematics of pool. This post will lay out the physics of billiard balls in as simple of a way as possible. There will be no code in this post. For simplicity, we will focus only on two pool balls colliding elastically without the presence of friction – a realistic enough scenario for any game.

Since our pool balls are confined to move along the plane of the table (i.e. they aren’t floating through the air), they have freedom to move in two dimensions. In addition, we have the good fortune that the balls are the same mass, which simplifies some calculations.

Let’s say that before the collision Ball 1 is moving with some velocity , while Ball 2 is moving with some velocity . These velocities can point anywhere in the plane of the table. In addition, immediately before the collision let’s label a vector which points from the center of Ball 1 to the center of Ball 2.

After the collision, Ball 1 has velocity and Ball 2 has velocity . Since the balls have not yet moved immediately after the collision, the same vector points from the center of Ball 1 to the center of Ball 2.

The first thing we will do, to simplify our equations, is move to a special reference frame where one of the balls (we will pick Ball 2) is initially at rest. This means that we are pretending that we are moving alongside Ball 2 so that it appears at rest with respect to us; in practice, this is equivalent to making the following substitution for the velocities:

Here the vectors represent the balls before the collision, and the vectors represent the balls after the collision. Note that all of the laws of physics we are used to are still upheld in this frame of reference, and we can switch back to our and values after the dust settles.

From conservation of angular momentum we have

which can be rearranged as

Next we apply conservation of kinetic energy (we are presuming an elastic collision) to get

which can be rearranged to get

Substituting our previous expression for , we have

Hence is perpendicular to . So far we have used three conservation equations (two components of momentum and one component of kinetic energy), but we have four components to solve for. Thus to uniquely solve for them, we need a fourth conservation equation. For this we will use conservation of angular momentum.

To simplify as much as possible, we will choose our axis of rotation to be perpendicular to the plane of the table and passing through the center of Ball 1. We will ignore the spin of the ball and will instead represent angular momentum by the expression , where is the velocity of the ball in question and is the displacement vector from the ball to the axis of rotation. Since Ball 1 is located on the axis of rotation, is zero for Ball 1 both before and after the collision; hence its angular momentum is zero in both cases. Likewise, in our reference frame Ball 2 is initially at rest – hence its angular momentum is also zero before the collision. Thus there is only one angular momentum term, which is from Ball 2 after the collision:

This implies that is parallel to the vector which points from the center of Ball 1 to the center of Ball 2. (It could also be *antiparallel* mathematically, but this would be an unphysical solution in which Ball 2 would pass through Ball 1. This sort of solution occurs due to the quadratic terms in the kinetic energy, which have two roots.)

Before we continue, we should make an important note that will be of great use when making our AI in the next post: **i****f Ball 2 is initially at rest (which is the reference frame we are dealing with here), then after the collision Ball 2 will move in the direction of the displacement vector which points from the center of Ball 1 to the center of Ball 2.**

Earlier, we proved that is perpendicular to . Since we have now proved that is parallel with , it follows that is perpendicular to . Hence their dot product must be zero:

Since is parallel with , it follows that :

We also can easily see that . Summing all of our results, the following equations completely determine the velocities of the balls after the collision:

In case you have forgotten our conventions, the vectors are the velocities of the balls before the collisions, the vectors are the velocities of the balls after the collisions, and is the displacement vector which separates their centers before the collision.

## 1 thought on “The Mechanics of Billiards”