# Determine resultant velocity of an elastic particle-particle collision in 3d space

So I have two particles that have collided in 3 dimensional space. I want the particles to rebound off of each other in an elastic manner. How do I determine the resultant velocity vector if I know: Both particles' initial velocity vector, their masses, and their initial position vectors relative to the origin.

I tried to follow the instructions on this website but I am not sure how to make their equations work without polar coordinates / how to translate my data to polar coordinates.

Also, if you answer my question in terms of polar coordinates, can you explain which angle is theta and which is phi? Since there are 2 different conventions, I am not really sure which angle is being referred to in the explanation on the aforementioned website.

EDIT: This isn't for a class. I'm writing a physics engine for a gravity simulation I am making using Unity. I haven't taken kinematics since I was in high school, which is why I am so rusty.

• Do you know how to do this in one dimension? How about two?
– Beta
Sep 30, 2013 at 2:07
• So coordinate conversions are not being taught anymore? Sep 30, 2013 at 2:43
• RE EDIT: this webpage might be helpful in explaining the 2D elastic collision. Sep 30, 2013 at 13:34

I'm shocked that there isn't a satisfactory answer on this site yet!

This can be answered in any number of dimensions with some relatively simple vector math. As follows intuitively (rigorously in the center-of-mass frame), for equal mass particles, the relative velocities of the particles are reversed along the normal direction. All that needs to be done is translate that into vector equations.

# The algorithm

Calculate the vector normal of collision: $$\hat{\bf n}=\frac{{\bf r}_1-{\bf r}_2}{\|{\bf r}_1-{\bf r}_2\|}$$ Calculate the relative velocity of the particles in the direction of the normal, using a dot product: $$v_{\mathrm{rel}}=(\dot{\bf r}_1-\dot{\bf r}_2)\cdot \hat{\bf n}$$

To reverse the velocities of the particles along the normal of collision, take:

$$\dot{\bf r}_1\mapsto \dot{\bf r}_1- v_{\mathrm{rel}}\hat{\bf n}$$ $$\dot{\bf r}_2\mapsto \dot{\bf r}_2+ v_{\mathrm{rel}}\hat{\bf n}$$

That's it. Easy peasy. It works in 1D, 2D, 3D, 4D, 5D; any number of dimensions. And it's rather simple!

# Seeing that the algorithm works

To see that this reverses the velocities along the normal direction, calculate $\dot{\bf r}_1\cdot \hat{\bf n}$ before and after. You'll find: \begin{align*} v_{\mathrm{rel}}= (\dot{\bf r}_1-\dot{\bf r}_2)\cdot \hat{\bf n} &\mapsto \dot{\bf r}_1\cdot \hat{\bf n}- v_{\mathrm{rel}}\hat{\bf n}\cdot \hat{\bf n}-\dot{\bf r}_2\cdot \hat{\bf n}- v_{\mathrm{rel}}\hat{\bf n}\cdot \hat{\bf n}\\ &=v_{\mathrm{rel}}-2v_{\mathrm{rel}}\\ &=-v_{\mathrm{rel}} \end{align*}

One key point is that the velocity and momentum of the center of mass of the system do not change as a result of the collision. I would recommend calculating the velocity of the center of mass prior to the collision, and then use the fact that it is unchanged to compute the new velocities. If the collision is truly elastic (no dissipation), then the kinetic energy of the system will also be conserved. Momentum and Kinetic Energy Conservation should be all you need to compute the post-collision velocities.

If you are writing your physics engine in cartesian coordinates, it's probably much easier to perform the collision calculations in cartesian coordinates instead of trying to use the equations from that website. Also, you speak of two particles colliding, which sounds to me as if you are treating them as point masses, while that site is performing calculations for two spheres colliding.

If you want to simulate elastic collisions between point masses in 3 dimensions in cartesian coordinates, it's probably easiest to just work out the equations yourself! That way you'll also have much less trouble debugging your code (this is from my personal experience).

• Wouldn’t a collision between point masses be a zero-probability event? Oct 23, 2014 at 18:39