= Solution
For a <zero-natural-length spring>, extension is the full distance between its endpoints, so the squared spring lengths are quadratic functions of the Cartesian coordinates. The <Lagrangian> is
$$
\boxed{\begin{aligned}
L={}&\frac{m_1}{2}(\dot X_1^2+\dot Y_1^2)+\frac{m_2}{2}(\dot X_2^2+\dot Y_2^2)\\
&-\frac{k_1}{2}(X_1^2+Y_1^2)-\frac{k_2}{2}\big[(X_2-X_1)^2+(Y_2-Y_1)^2\big]\\
&-g(m_1Y_1+m_2Y_2).
\end{aligned}}
$$
The gravitational <potential energy> has positive derivative in the upward coordinate, giving downward forces. Applying the <Euler-Lagrange equations> to all four coordinates gives
$$
\boxed{\begin{aligned}
m_1\ddot X_1+(k_1+k_2)X_1-k_2X_2&=0,\\
m_2\ddot X_2+k_2X_2-k_2X_1&=0,\\
m_1\ddot Y_1+(k_1+k_2)Y_1-k_2Y_2&=-m_1g,\\
m_2\ddot Y_2+k_2Y_2-k_2Y_1&=-m_2g.
\end{aligned}}
$$
The two spring forces are equal and opposite on the two masses for the connecting spring, as required by <Newton's third law>.
Back to article page