Lagrangian mechanics is based on the Principle of Stationary Action (also known as the principle of least action). It uses the Lagrangian, , a function that represents the difference between the kinetic energy, , and potential energy, , of a system:

The dynamics of the system are derived by finding the path for which the action, , defined as the integral of the Lagrangian over time, is stationary (i.e., does not change for small variations of the path). This leads to the Euler-Lagrange equations:

where are the generalized coordinates of the system, and are their time derivatives.