Lagrangian of two particles connected with a spring, free to rotate Two particles of different masses $m_1$ and $m_2$ are connected by a massless spring of spring constant $k$ and equilibrium length $d$. The system rests on a frictionless table and may both oscillate and rotate.
I need to find the Lagrangian for this system. I'm not sure if I'm interpreting it correctly, but I think there are 4 degrees of freedom in this problem, $x_1, y_1, x_2, y_2$ or $r_1,\theta_1,r_2,\theta_2$. If I use the former choice I get my Lagrangian to be
$L = \frac{1}{2}m_1(\dot{x_1}^2 + \dot{y_1}^2) + \frac{1}{2}m_2(\dot{x_2}^2 + \dot{y_2}^2) - \frac{1}{2}k(\sqrt{(x_1-x_2)^2+(y_1-y_2)^2} -d)^2$.
Does this make any sense? It seems like the EOM would be a mess in this case.
 A: This is correct, and you should use the rectangular coordinates until later. The equations of motion aren't a mess, because the system has a center of mass conservation law, so you can linearly mix up the variables:
$$ X = m_1 x_1 + m_2 x_2$$
$$ Y= m_1 y_1 + m_2 y_2 $$
for the center of mass and 
$$ x = x_1 - x_2 $$
$$ y = y_1 - y_2 $$
which are the relative coordinates. In terms of this transformation (which is something you should just know), the Lagrangian for the CM becomes that of a free particle, while the Lagrangian for the relative coordinate becomes that of a 2d particle on a spring of finite length
$$ {m (\dot{x}^2 + \dot{y}^2)\over 2}  + {k (\sqrt{x^2 + y^2} - d)^2\over 2}, $$
where m is the reduced mass. Now you can transform the relative coordinates x,y into polar form $r,\theta$ and the $\theta$ equation is expressing conservation of angular momentum. This reduces to a 1d problem for r with a potential.
$$ V(r) = {k\over 2}(r-d)^2 + {A\over r^2}, $$
where A is a constant for constant angular momentum an effective centrifugal repulsion plus the attractive potential. 
A: Your lagrangian is right,  but it is needlessly complicated. For two isolated masses, it is always best to move to centre-of-mass and relative coordinates,
$$X=\frac{m_1x_1+m_2x_2}{m_1+m_2},$$
$$x=x_2-x_1,$$
and similarly for the $y$s. The kinetic energy is then expressed using the total mass $M=m_1+m_2$ and the reduced mass $m$ such that $\frac{1}{m}=\frac{1}{m_1}+\frac{1}{m_2}$, and your lagrangian becomes quite a bit simpler:
$$L=\frac{1}{2}M\left(\dot{X}^2+\dot{Y}^2\right)+\frac{1}{2}m\left(\dot{x}^2+ \dot{y}^2 \right)-\frac{1}{2}k\left(r-d\right)^2$$
for $r=\sqrt{x^2+y^2}$.
