equation solving – How to find velocities of two particles in center of mass frame given lab frame using mathematica

given a particle with mass m1 and velocity v1 (lab frame) as well as a particle with mass m2 and velocity v1,2 with respect to particle 1, how can I find the velocities in the center of mass frame using mathematica?
Also how do I show the energy and momentum of the system can be expressed using the reduced mass u and v1,2?
I can do the physics on paper, but is there a way to do this using mathematica that i’m missing?

Thanks in advance.