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
The gravitational potential energy has positive derivative in the upward coordinate, giving downward forces. Applying the Euler-Lagrange equations to all four coordinates gives
The two spring forces are equal and opposite on the two masses for the connecting spring, as required by Newton's third law.
At equilibrium, the two horizontal equations imply and then , so both vanish. Adding the two vertical equations gives ; the second separately gives . Hence
Retain the imposed constraint and set , , . Subtracting the equilibrium equations cancels all constant gravitational terms. For , the small-oscillation mass and stiffness matrices are
The horizontal reaction enforcing the constraint replaces the removed equation; it is not necessary to demand that the original unconstrained horizontal force on mass 2 vanish during motion. Because the zero-natural-length spring potentials are exactly quadratic, these displacement equations are actually exact within the ideal spring model, not merely first-order approximations.