# Trick for reformulating in terms of centre of mass and relative variables

I am working through a problem that has caused me difficulties in the past. I have the Hamiltonian $$\mathcal{H}=\frac{p_1^2}{2m_1}+\frac{p_2^2}{2m_2}+\frac{k}{2}(q_1-q_2)^2$$ I want to express the Hamiltonian as a function of the center of mass variables $$Q\equiv \frac{m_1q_1+m_2q_2}{m_1+m_2}$$ and $$V\equiv \frac{m_1v_1+m_2v_2}{m_1+m_2}$$ and the variables $$q\equiv q_1-q_2$$ $$v\equiv v_1-v_2$$ This seems straightforward but I feel I am missing the trick. I believe that this type of problem occurs regularly in physics.

So I get before becoming stuck that, \begin{align} \mathcal{H}=\frac{p_1^2}{2m_1}+\frac{p_2^2}{2m_2}+\frac{k}{2}(q_1-q_2)^2 &= \frac{p_1^2}{2m_1}+\frac{p_2^2}{2m_2}+\frac{k}{2}(q)^2 \\ &= \frac{m_1v_1^2}{2}+\frac{m_2v_2^2}{2}+\frac{k}{2}q^2 \\ &= \frac{m_1v_1^2+m_2v_2^2}{2}+\frac{k}{2}q^2 \\ \end{align}

What is the trick for these types of questions?

You are at a point where you'll need $v_1$ and $v_2$. Observe from the original transformation that: $$v_2 = v_1 - v$$ $$\implies V = \frac{(m_1+m_2)v_1 -m_2v}{m_1+m_2}$$ $$v_1 = V + \frac{m_2v}{m_1+m_2}$$ We also get, by a similar procedure, $$v_2 = V - \frac{m_1v}{m_1+m_2}$$ We have expressed $v_1$ and $v_2$ in terms of the new variables, $V$ and $v$. Plugging these in the expression for $\mathcal{H}$ should lead you to the Hamiltonian in the centre-of-mass/relative coordinates.