The magnitude of this vector is obviously going to depend on the speed of the impact, the mass of the spheres and how direct the collision was.

Firstly, define some variables:

points:s1, s2vectors:a, b, c, d, impulse, impactfloats:ImpactSpeed, mass1, mass2

The speed of the impact is easy to calculate. The speed we're interested in is only that along the line of impulse. So first calculate the difference between the impact velocities and the impulse vector:

Now, to calculate the component of one vector along another, we take a dot product:impact=b-aimpulse= normalise(s2-s1)

Note: This is an unnormalised dot product. You do not divide by the magnitude of the vectors, so no square root is required.ImpactSpeed= dotproduct(impact,impuse)

Now, the impulse is multiplied by the impact speed and the masses:

impulse=impulse* square_root(ImpactSpeed*mass1*mass2)

and the impulse can be applied to the initial velocities to get the resultant velocities:

c=a+impulse/mass1d=b-impulse/mass2