# Elastic Collisions in 1D

I need a nice model to predict the final velocity when two balls collide elastically. Don’t worry why I need this—just trust me.

After working on this for a short bit and making an error, I realized what I need to do. I need to blog about it. A blog is the perfect place to work things out.

So, here is the situation. A ball of mass 10 kg (ball A) is moving with a speed of 0.1 m/s in the positive x-direction. This collides with a 1 kg ball (ball B) moving at 0.1 m/s in the negative x-direction. What is the final velocity of the two balls if the collision is perfectly elastic.

For a perfectly elastic collision, the following two things are true:

• Momentum is conserved. The total momentum before the collision is equal to the total momentum after the collision.
• Kinetic energy is conserved. The total kinetic energy is the same before and after the collision.

In one dimension, I can write this as the following two equations. I’m going to drop the “x” notation since you already know it’s in the x-direction. Also, I am going to use A1 for the velocity of A before the collision and A2 for after. Same for ball B.

$m_Av_{A1}+m_B v_{B1} = m_Av_{A2}+m_B v_{B2}$

$\frac{1}{2}m_A v_{A1}^2+\frac{1}{2}m_B v_{B1}^2 = \frac{1}{2}m_A v_{A2}^2+\frac{1}{2}m_B v_{B2}^2$

That’s two equations and two unknowns (the two final velocities). Before solving this, I want to find the answer with a numerical calculation.

Numerical Solution

Here’s the basic plan (I’m not going over all the deets).

• Model the two masses as points with springs on them (not really going to show the springs).
• When the two masses “overlap” there is a spring force pushing them apart. The strength of this force depends on the amount they overlap.
• Calculate the position and force on each ball (the force would be the zero-vector in cases where they aren’t “touching”).
• Update the momentum of the balls.
• Update the position of the balls.
• Repeat until you get bored.

Oh, make sure you set your fake spring constant high enough. If it’s too low, the two masses can just pass through each other (which would still be an elastic collision).

Here is what it looks like.

Here is the code (you should take a look). Oh, the final velocities are 0.0636 m/s for ball A and 0.2639 m/s for ball B. Also, here is a plot of the momentum so you can see momentum is conserved.

What about the kinetic energy? Here you go.

Actually, notice that KE is NOT conserved. During the collision there is a decrease in the total KE because of the elastic potential energy. I just thought that was cool.

Analytical Solution

Now let’s get to solving this sucker. I’m going to start with a trick—a trick that I’m pretty sure will work (but not positive). Instead of having the two balls moving towards each other at a speed of 0.1 m/s each, I am going to use the reference frame that has ball B with an initial speed of 0 m/s and ball A with a speed of 0.2 m/s.

Since I am switching reference frames, I am going to rename the velocities. I am going to call ball A velocity C1 and C2 and then ball B will be D1 and D2 (for final and initial). Technically, I should use prime notation – but I think it will just get messy.

So, here is how it looks in the new reference frame.

In general, the initial C velocity would be:

$v_{C1}=v_{A1}-v_{B1}$

Now I get the following for the momentum and kinetic energy conservation equations.

$m_A v_{C1}=m_A v_{C2}+m_B v_{D2}$

$\frac{1}{2}m_A v_{C1}^2=\frac{1}{2}m_A v_{C2}^2 +\frac{1}{2}m_B v_{D2}^2$

Now we have two equations two unknowns. I’m going to cheat. I worked this out on paper and I’m just going to take a picture of it.

Here is the final solution (in case you can’t read it).

$v_{C2} = v_{C1}-\frac{m_B}{m_A}v_{D2}$

$v_{D2} = \frac{2v_{C1}}{\frac{m_B}{m_A}+1}$

So, you can get a value for vD2 and then plug that into vC2. After that, you can convert them back to the stationary reference frame to get vA2 and vB2.

Boom. It works. Here is my calculation. Just to be clear, it looks like this:

The output looks like this:

Winning. That agrees with my numerical model.

# Projectile in Polar Coordinates

Why?  There is no why.

Suppose a ball is shot at an angle θ with an initial velocity v0.  What will the motion be like in polar coordinates?

First, let me start with Newton’s 2nd Law in polar coordinates (I derived this in class).

$F_r = m(\ddot{r}-r\dot{\theta}^2)$
$F_\theta = m(r\ddot{\theta}+2\dot{r}\dot{\theta})$

Once the ball is in the air (and ignoring air resistance) the only force on the ball is the gravitational force. Yes, this would be -mg in the y-direction, but we don’t have a y-direction. Instead, we have polar coordinates. Maybe this picture will help.

The r and θ components of the gravitational force will change as:

$F_r = -mg\sin\theta$
$F_\theta = -mg\cos\theta$

If I use these forces with Newton’s law in polar coordinates, I get:

$F_r = -mg\sin\theta=m(\ddot{r}-r\dot{\theta}^2)$
$F_\theta = -mg\cos\theta = m(r\ddot{\theta}+2\dot{r}\dot{\theta})$

Of course the mass cancels – but now I can solve the first equation for $\ddot{r}$ and the second equation for $\ddot{\theta}$.

$\ddot{r} = r\dot{\theta}^2-g\sin\theta$
$\ddot{\theta} = \frac{-2\dot{r}\dot{\theta}}{r} - \frac{g\cos\theta}{r}$

It doesn’t matter that these second derivatives depend on the other stuff – I can still calculate them. Once I have those, I can create a numerical calculation to update the velocities and positions. Suppose I have everything know at time(1), then the stuff at time(2) would be:

$\dot{r}_2 = \dot{r}_1 +\ddot{r}\Delta t$
$\dot{\theta}_2 = \dot{\theta}_1 +\ddot{\theta}\Delta t$
$r_2 = r_1+\dot{r}\Delta t$
$\theta_2 = \theta_1 +\dot{\theta}\Delta t$
$t_2 = t_1 +\Delta t$

Now I’m all set to do a numerical calculation. Well, I still need the initial conditions. I could use this:

$\dot{r}_0 = v_0$
$r_0 =0$
$\dot{\theta}_0 = 0$
$\theta_0 = \theta_0$

But wait! There’s a problem. The calculation for $\ddot{\theta}$ has a 1/r term. If r is zero the universe will explode. I can fix this by having the initial r a little bit bigger than zero. Problem solved.

Here is the program in Glowscript.

For the first run, I am going to calculate the x- and y-coordinates in each step and plot x vs y.  I know this should look like a parabola.

Boom.  That works.  Now for a plot of both r and theta as a function of time for a high launch angle.

Double boom.