Two particles of mass $m$ can move smoothly along the $x$-axis and are connected by a spring of natural length $l$ and spring constant $k$.
Here are the questions and my proposed answers. I'm stuck on the last question. I really hope you can help me.
1) If the coordinates of the particles are $x_1$ and $x_2$, show that the potential energy stored in the spring is $\frac{1}{2}k(\space x_2-x_1-l)^2$.
Answer: $PE_{spring}=\frac{1}{2}kx^2$ where $x$ is the extension of the spring relative to equilibrium.
$$x=(x_2-x_1-l)$$ $$\implies \space V=\frac{1}{2}k(\space x_2-x_1-l)^2 .$$
2) Hence deduce the Lagrangian of the system.
Answer: $L=T-V$ where $T$= kinetic energy. $$T=\frac{1}{2}m(\dot {x}_1^2 +\dot {x}_2^2)$$
Substituting into $L=T-V$ we have
$$L=\frac{1}{2}m(\dot {x}_1^2 +\dot {x}_2^2)-\frac{1}{2}k(x_2-x_1-l)^2.$$
3) Write down the Lagrange equations of motion and show that the general solution satisfies the condition $x_1+x_2=Ct +D, x_1-x_2=-l+A\cos(\omega t)+B\sin(\omega t)$ where $\omega =\sqrt{\frac{2k}{m}}$. And hence describe the motion of the system.
I'm really stuck on this question. Any help would be much appreciated.
You should first obtain the Lagrange equations: $$ \frac{d}{dt}\frac{\partial L}{\partial \dot{x}_1}-\frac{\partial L}{\partial x_1}=m\ddot{x}_1-k(x_2-x_1-l)=0 $$ $$ \frac{d}{dt}\frac{\partial L}{\partial \dot{x}_2}-\frac{\partial L}{\partial x_2}=m\ddot{x}_2+k(x_2-x_1-l)=0 $$ By summing the two equations we obtain: $$ m(\ddot{x}_1+\ddot{x}_2)=0\implies x_1+x_2=Ct+D $$ By subtracting the two equations we obtain $$ m(\ddot{x}_1-\ddot{x}_2)-2k(x_2-x_1-l)=0 $$ and by setting $x=x_1-x_2$ we have $$ m\ddot{x}+2kx=2kl $$ which is a simple differential equation whose solution is an translated harmonic motion.