Let $x_{1} , x_{2}, x$ points which are forced to move on a line, the mass of $x$ is M and the mass of $x_{1} , x_{2}$ is m with $M>m$. The points $x_{1} , x_{2}$ are connected to $x$ via two ideal springs with elastic constant $k>0$. Gravity is not to be considered.
The Lagrangian of the system is $\mathcal L = \frac{1}{2}(m( \dot x_{1}^2 + \dot x_{2}^2) + M\dot x^2) - \frac{1}{2}k((x-x_{1})^2 + (x-x_{2})^2)$
Turns out, total momentum is a conserved quantity independent from the Energy.
My question is how could I reduce the degree of the system?
I tried to replace the momentum inside the energy equation but I cannot delete one of the variables from the potential term.