Speed is important, but just as important is direction.
Speed and direction together is called Velocity.
If car A is going 50mph North and car B is going 50mph South and they collide their impact will have an outcome of 0mph. Of course their cars will be flattened, crunched, and have dead passengers...
When trying to figure this out keep direction in mind.
-Gan
P.S. I can give you the real equation though it involves vectors. A vector is a magnitude and direction. Such as 50mph North. It uses trigonometry to find the correct speed and direction outcome of two colliding objects.