Choose positive so the bob is displaced to the right relative to the cart. Its Cartesian coordinates are
Differentiation gives . Thus the exact kinetic energy and potential energy are
Retain quadratic terms, using in the kinetic cross term and in the potential. The Lagrangian is
Its Euler-Lagrange equations give
The kinetic cross term is essential: acceleration of the support couples the pendulum and cart. These equations define the normal modes of a spring-mounted pendulum cart.