In Lagrangian mechanics, generalized coordinates describe the independent configurations allowed by the constraints. For particles with ordinary conservative forces in an inertial frame, use , with kinetic energy and potential energy . Holonomic constraints can often be built into the coordinates, avoiding explicit constraint forces.
The principle of stationary action makes the action stationary for variations vanishing at the endpoints. Integrating the velocity variation by parts gives
Since each independent variation is arbitrary, the Euler-Lagrange equations are
If nonconservative generalized forces are present, their components appear on the right. The formalism is invariant under suitable coordinate changes and adding a total time derivative to leaves the fixed-endpoint equations unchanged.
The generalized momentum is . If is cyclic, and is conserved. If has no explicit time dependence, the conserved energy function is
For a kinetic energy quadratic in velocities and a velocity-independent potential energy, this equals . This connects symmetry to conservation laws.
For example, a simple pendulum of mass and length has
Its tension does not appear because the fixed-length constraint is already imposed. Expanding for small gives simple harmonic motion with . More generally, expansion of and to quadratic order about a stable equilibrium leads directly to the normal-mode eigenvalue problem.
Lagrangian mechanics expresses dynamics through generalized coordinates that respect the constraints. For a system with conservative, velocity-independent forces and standard kinetic energy, the Lagrangian is . Its equations follow from the principle of stationary action:
for variations that vanish at the endpoints. Varying the integral and integrating the term by parts gives
Independent variations therefore yield the Euler-Lagrange equations:
Additional nonconservative generalized forces appear on the right-hand side as . The action is stationary, not necessarily a minimum. For ideal holonomic constraints, using suitable generalized coordinates removes the need to solve explicitly for constraint forces.
The conjugate momentum is . If a coordinate is cyclic, and its conjugate momentum is conserved. If has no explicit time dependence, the energy function
is conserved. It equals for the usual quadratic kinetic energy with time-independent geometry, but that identification is not universal for every Lagrangian or constraint.
For example, a simple pendulum with angle , length and bob mass has
The tension does no virtual work in the allowed angular displacement and never needs to be calculated to obtain the angular equation. The method scales naturally to coupled systems and coordinates with complicated geometry.
If , the action changes by an endpoint term:
In the principle of stationary action with fixed endpoints, and the endpoint times are fixed. Therefore , and the two actions give the same bulk Euler-Lagrange equations.
For a Lagrangian density, adding changes the action by , by the divergence theorem. Its variation vanishes for compactly supported field variations, or when the appropriate boundary data are held fixed. These total divergences in a variational principle can therefore be discarded when deriving bulk equations under those conditions.
The qualification about boundaries matters: if depends on field derivatives, their variations on the boundary must also be controlled. A total derivative can change the canonical momenta or the chosen representative of a Noether current, even while leaving the bulk dynamics unchanged.