You can derive a pair of equations to describe the velocities of objects with masses $m$ and $M$ and initial velocities $u_{a}$ and $u_{b}$ involved in an elastic collision.
In elastic collisions, both momentum and kinetic energy are conserved. The conservation of momentum is:
Total momentum before = Total momentum after
And the conservation of kinetic energy is:
Total kinetic energy before = Total kinetic energy after
Taking the conservation of momentum, we can rearrange it to bring all the $m$ and $M$ terms to the same side, and factorise each side:
And doing the same for the conservation of energy:
As we have the terms $\left({u_{a}}^{2}-{v_{a}}^{2}\right)$ and $\left({v_{b}}^{2}-{u_{b}}^{2}\right)$, we can use the difference of two squares:
To produce:
Now divide equation 5 by equation 3. On the left, $m$ and the whole factor $\left(u_a-v_a\right)$ both appear in the numerator and denominator, so they cancel; the same happens with $M$ and $\left(v_b-u_b\right)$ on the right:
Which leaves us with:
Or:
This is an interesting equation, as it tells us that in an elastic collision, the relative speed of the two objects as they approach, $u_{a}-u_{b}$, is equal to the relative speed of the two objects as they separate, $v_{b}-v_{a}$, i.e.:
the speed of approach = the speed of separation
We are now able to substitute equation 6 into the conservation of momentum equation, equation 1:
The bracket can be multiplied out, and all the terms containing a $u$ brought to the same side:
The right hand side can now be factored, and the left simplified:
Therefore:
If one of the objects is initially stationary when the two collide, this simplifies to:
To find the final velocity of the other object, we can either use the relative speeds of approach and separation, or substitute equation 7 into equation 6:
We can now factor for $u_{a}$ and $u_{b}$ to get:
We need to get rid of the 1s, and bring both terms in the brackets over a common denominator of $\left(m+M\right)$, using:
The equation becomes:
Which simplifies to:
And, if one of the objects is stationary in the collision, this becomes:
Equations 8 and 10 also help explain some of the examples of momentum you've studied, such as a Newton's cradle, or the collision between two objects of the same mass on an air track, where the initial velocity of one of them is zero:
In equation 8, if the masses are the same, they cancel out entirely, leaving $v_{b}=u_{a}$: the second object continues with exactly the same velocity the first one had. And in equation 10, if $m-M=0$, then $v_{a}=0$: the first object simply stops in the collision, which is exactly what's observed.