Classical Mechanics

Lagrangian Mechanics

Energy-difference reformulation that turns Newton's laws into a path-integral problem

Lagrangian mechanics reformulates Newton's laws as a single scalar equation: a system follows the path that makes the time-integral of L = T − V stationary. From this one-line principle, every equation of motion in classical physics — and the gateway to quantum field theory — falls out automatically.

  • FormulatedJoseph-Louis Lagrange, 1788
  • Central objectL = T − V
  • Equation of motiond/dt(∂L/∂q̇) = ∂L/∂q
  • Variational principleδS = 0
  • Modern descendantFeynman path integral

Interactive visualization

Press play, or step through manually. The visualization is yours to drive — try it before reading on.

Open visualization fullscreen ↗

Watch the 60-second explainer

A condensed visual walkthrough — narrated, captioned, under a minute.

The shift from forces to energies

Newton's mechanics asks: what forces act on this object, and in what direction? Solve F = ma component by component, in a coordinate system you have to choose, and propagate. It is operational and concrete, but it is also fragile — change coordinates and the equations have to be re-derived; add a constraint (a bead on a wire, a pendulum on a moving pivot) and you suddenly need to track the force the wire exerts on the bead even though you do not care about it.

Lagrange, in his Mécanique analytique of 1788, reformulated the whole subject without a single force diagram. The recipe is two steps: write down the kinetic energy T and the potential energy V of the system in any coordinates that are convenient; form the Lagrangian L = T − V; then plug L into the Euler-Lagrange equation and read off the equations of motion. Constraint forces never appear because they do no virtual work. Coordinate changes cost nothing because L is a scalar.

The deeper rephrasing is variational. Define the action

S[q] = ∫ L(q, q̇, t) dt   (from t₁ to t₂)

over any trial path q(t) with fixed endpoints. The actual motion is the path that makes S stationary — δS = 0. Mechanics becomes the calculus of variations applied to a single number.

The Euler-Lagrange equation

To find the extremal path, vary q(t) → q(t) + εη(t) where η vanishes at the endpoints. Expanding S to first order in ε and integrating by parts gives

δS = ∫ [∂L/∂q − d/dt(∂L/∂q̇)] η dt = 0

For δS to vanish for arbitrary η, the bracket must vanish at every t. This is the Euler-Lagrange equation:

d/dt(∂L/∂q̇) − ∂L/∂q = 0

For each generalized coordinate qi there is one such equation. With n degrees of freedom you get n second-order ODEs — the same count Newton would give you, just derived from a single scalar. Note that there is no coordinate-system bias: q can be a Cartesian coordinate, an angle, a normal-mode amplitude, or anything else.

Worked example: the simple pendulum

Take a mass m on a massless rod of length ℓ swinging in a vertical plane under gravity g. Newton's approach demands the tension in the rod even though it does no work. The Lagrangian approach picks one generalized coordinate, the angle θ from vertical, and computes:

x = ℓ sin θ,    y = −ℓ cos θ
ẋ = ℓ cos θ · θ̇,    ẏ = ℓ sin θ · θ̇
T = ½ m (ẋ² + ẏ²) = ½ m ℓ² θ̇²
V = m g y = −m g ℓ cos θ
L = T − V = ½ m ℓ² θ̇² + m g ℓ cos θ

The single Euler-Lagrange equation in θ:

∂L/∂θ̇ = m ℓ² θ̇
d/dt(∂L/∂θ̇) = m ℓ² θ̈
∂L/∂θ = −m g ℓ sin θ

⇒ m ℓ² θ̈ + m g ℓ sin θ = 0
⇒ θ̈ + (g/ℓ) sin θ = 0

The classic pendulum equation, derived in five lines without ever drawing the rod's tension. For small θ, sin θ ≈ θ and you get simple harmonic motion with angular frequency ω = √(g/ℓ). With ℓ = 1.00 m and g = 9.81 m/s², ω = 3.13 rad/s and the period T = 2π/ω = 2.01 s. A real pendulum-clock seconds-pendulum is tuned to ℓ = 0.994 m for a half-period of 1.00 s.

The famous problem: brachistochrone

In 1696 Johann Bernoulli posed: between two points at different heights, what curve down which a bead slides under gravity (no friction) gives the shortest time? Galileo had guessed an arc of a circle. Bernoulli, Newton, Leibniz, l'Hôpital and Jakob Bernoulli all submitted solutions. The right answer is a cycloid — the curve traced by a point on a rolling wheel — and it falls out of the Euler-Lagrange equation in a few lines.

Parametrize the curve by x with y(x) the unknown. The bead's speed at height y, starting from rest at the origin, is v = √(2g·(−y)) (taking y negative below). The time element is dt = ds/v with ds = √(1 + y'²) dx. The total time is

T[y] = ∫ √[(1 + y'²) / (−2g y)] dx

This is the action with effective Lagrangian L = √[(1 + y'²) / (−2g y)]. Because L has no explicit x dependence, the Beltrami identity gives a first integral:

L − y' (∂L/∂y') = constant
⇒ √[1 / ((−2g y)(1 + y'²))] = 1/√(2g · k)
⇒ y (1 + y'²) = −k

Substituting y = −k sin²(φ/2) makes the ODE separable; integration gives the parametric cycloid x = (k/2)(φ − sin φ), y = −(k/2)(1 − cos φ). Same curve, ten lines of variational calculus, no clever geometric construction. This is the kind of problem the Lagrangian method was built for.

Lagrangian vs Newtonian formulations

NewtonianLagrangianHamiltonian
Central quantityForce FL = T − VH = T + V
VariablesPosition, velocityGeneralized coords (q, q̇)Coords and momenta (q, p)
Dynamical equationF = ma (vector)d/dt(∂L/∂q̇) = ∂L/∂qq̇ = ∂H/∂p, ṗ = −∂H/∂q
ConstraintsConstraint forces explicitConstraints absorbed into coordsConstraints become Poisson structure
Coordinate freedomCartesian preferredAny coords; same formCanonical transformations
Order of equations2nd order in time2nd order in time1st order, 2× as many
Quantum analogueNone directlyPath integral ∫𝒟q · e^(iS/ℏ)Canonical quantization [q,p] = iℏ
Field-theory readyAwkwardL → ℒ density, integrated over 4-volumePhase space → field configurations

The three formulations describe the same physics, but each one is a better starting point for a different problem. Lagrangians dominate quantum field theory because the action is manifestly Lorentz-invariant. Hamiltonians dominate phase-space analysis and quantization. Newton dominates introductory courses because force diagrams are concrete.

Cyclic coordinates and conservation

If a coordinate q does not appear in the Lagrangian (only q̇ does), it is called cyclic. The Euler-Lagrange equation immediately gives

d/dt(∂L/∂q̇) = ∂L/∂q = 0    ⇒    p_q = ∂L/∂q̇ = constant

The conjugate momentum pq is conserved. For a free particle in Cartesian coordinates, none of x, y, z appears in L = ½m(ẋ²+ẏ²+ẏ²), so all three linear momenta are conserved. For a central potential V(r), the Lagrangian in spherical coordinates has no φ dependence, so the angular momentum pφ = mr² sin²θ · φ̇ is conserved — Kepler's second law without a force argument.

This is a glimpse of Noether's theorem, which generalizes the cyclic-coordinate observation: every continuous symmetry of the action corresponds to a conserved quantity. Translation invariance gives momentum conservation, rotational invariance gives angular momentum, time-translation invariance gives energy.

Where Lagrangian mechanics shows up

  • Robotics and multibody dynamics. The MIT Cheetah, Boston Dynamics Atlas, and every industrial robot arm derive their controllers from the Lagrangian of n linked rigid bodies. With 18 joints in Atlas, you would never derive 18 coupled F = ma equations by hand; the Lagrangian is generated symbolically by software like RBDL or Pinocchio in milliseconds.
  • Spacecraft trajectory optimization. NASA JPL's interplanetary trajectory designs (Cassini, Voyager, JUICE) minimize fuel via the principle of stationary action with Pontryagin's maximum principle as the variational extension. Cassini's 2.5 billion-km tour of Saturn used a Lagrangian-derived control law that saved ~60% of the propellant a Hohmann transfer would have required.
  • Quantum field theory. The Standard Model is defined by a Lagrangian density ℒ_SM with 19 free parameters. The whole edifice — quark interactions, the Higgs mechanism, the W and Z bosons — is derived by writing all terms compatible with gauge symmetry and applying the Euler-Lagrange equations to ℒ_SM. The 2012 Higgs discovery at CERN tested one specific term in this Lagrangian.
  • General relativity. Einstein's field equations come from varying the Einstein-Hilbert action S = ∫(R/(16πG)) √(−g) d⁴x with respect to the metric gμν. The 10 components of Einstein's equations are 10 Euler-Lagrange equations from one scalar Lagrangian. LIGO's detection of GW150914 was a test of solutions to these equations.
  • Computational mechanics and finite elements. Modern structural analysis (ANSYS, Abaqus, COMSOL) builds discrete equations from variational principles. The displacements that minimize the elastic potential energy give the finite-element solution. A typical aerospace stress analysis solves 10⁶ to 10⁸ Lagrangian degrees of freedom on a workstation in minutes.

Holonomic constraints and Lagrange multipliers

If a constraint is holonomic — expressible as f(q, t) = 0 — you can either (a) absorb it by choosing fewer generalized coordinates that already satisfy it, or (b) keep all coordinates and add a Lagrange multiplier λ:

L_eff = L(q, q̇, t) + λ f(q, t)

The Euler-Lagrange equations now produce one equation per coordinate plus the constraint equation. The multiplier λ turns out to be exactly the constraint force, useful when you actually do want to know the tension in the rod or the normal force on the wire. For a bead on a frictionless circular wire of radius R, choosing θ as the generalized coordinate eliminates the constraint, but if you want the wire's reaction force you keep both x and y and add λ(x² + y² − R²) to L.

Non-holonomic constraints (those involving velocities that cannot be integrated, like rolling without slipping for a sphere on a plane) need a more general apparatus, the Lagrange-d'Alembert principle. They are why the dynamics of a rolling coin or a unicycle are surprisingly subtle.

Variants and extensions

  • Hamiltonian mechanics. Legendre-transform L into H(q, p, t) = p·q̇ − L. The 2nd-order Euler-Lagrange equations become 2n first-order Hamilton equations. Phase space, Poisson brackets, and canonical transformations live here.
  • Hamilton-Jacobi theory. Treat the action S as a function of the endpoint and time and derive a single first-order PDE: ∂S/∂t + H(q, ∂S/∂q, t) = 0. The closest classical analogue to the Schrödinger equation; sometimes lets you solve mechanics by separation of variables.
  • Field theory. Replace the discrete coordinate q(t) with a field φ(x, t). The Lagrangian becomes a density ℒ(φ, ∂μφ) integrated over spacetime. Maxwell's equations, the Klein-Gordon equation, the Dirac equation, and the Standard Model all come from such field Lagrangians.
  • Path integral quantization. Feynman's recipe: the quantum amplitude to go from A to B is ∫ 𝒟q e^(iS[q]/ℏ) summed over all paths. As ℏ → 0 the integral is dominated by the stationary-phase path — i.e. δS = 0, the classical equation of motion. Lagrangian mechanics is therefore the classical limit of quantum mechanics.
  • Lagrangian neural networks (LNN). A 2020 development: learn the Lagrangian L from data with a neural net, then enforce the Euler-Lagrange equations as the integrator. Conserves energy automatically and generalizes far better than vanilla MLPs on physical systems. Used today in molecular-dynamics surrogates and robotics simulators.

Common pitfalls

  • Confusing L with energy. L = T − V is not a physical energy; you cannot measure it. The Hamiltonian H = T + V is the energy (when conditions are right). The Lagrangian's role is purely as the integrand whose integral is extremized.
  • Missing the time derivative. The Euler-Lagrange equation has d/dt acting on ∂L/∂q̇, not just ∂L/∂q̇ alone. The time derivative includes implicit dependence through q(t) and q̇(t) — students drop terms when q̇ multiplies q in L.
  • Picking redundant coordinates. If you use both θ and the constraint x² + y² = ℓ², you must add a Lagrange multiplier; if you ignore the constraint you get the wrong equations. Either reduce to independent coordinates or use multipliers — not a hybrid.
  • Forgetting non-conservative forces. The plain Lagrangian formulation assumes the forces come from a potential V. Friction, drag, and other dissipative forces need either Rayleigh's dissipation function or a generalized force Q on the right-hand side: d/dt(∂L/∂q̇) − ∂L/∂q = Q.
  • Treating "least action" literally. The action is stationary, not necessarily minimum. For the simple harmonic oscillator the action is a minimum for half-periods shorter than π/ω and a saddle point beyond. Path-integral interference exploits this — call it the principle of stationary action and you are right always.

Frequently asked questions

Why is the Lagrangian L = T − V and not T + V?

The minus sign is what makes the Euler-Lagrange equation reproduce Newton's second law. With L = T − V you get d/dt(∂L/∂q̇) − ∂L/∂q = 0, which for a single particle becomes d/dt(mq̇) = −∂V/∂q, i.e. ma = F. With T + V (which is the Hamiltonian, not the Lagrangian) the same machinery gives the wrong sign. The Lagrangian is not energy; it is a mathematical object whose extremum encodes the dynamics.

Is the action always minimized?

No — it is stationary, meaning δS = 0. For short paths the action is usually a local minimum, but for longer paths it becomes a saddle point. The textbook name "principle of least action" is a 19th-century misnomer; the modern statement is the principle of stationary action. Feynman path integrals make full use of the saddle structure.

When is the Lagrangian formulation better than Newtonian?

Whenever there are constraints, awkward coordinates, or many degrees of freedom. For a bead on a hoop, polar pendulum, or double pendulum, writing F = ma in Cartesian coordinates is painful because constraint forces appear that you don't care about. The Lagrangian uses generalized coordinates (the angle, the arc length) and constraint forces drop out automatically. For straight-line motion of one mass under one force, Newton is faster.

What are generalized coordinates?

Any independent set of variables that uniquely specifies the configuration of the system. For a pendulum the generalized coordinate is the angle θ — one number, not two Cartesian (x, y) coordinates with a constraint x² + y² = ℓ². The number of generalized coordinates equals the number of degrees of freedom. They can be angles, arc lengths, normal-mode amplitudes, anything — the Euler-Lagrange equation does not care.

How does Lagrangian mechanics connect to quantum mechanics?

Through the Feynman path integral. A quantum amplitude for going from A to B is a sum over all possible paths of e^(iS/ℏ), where S is the classical action. In the limit ℏ → 0, paths far from the classical extremum interfere destructively and only the stationary-action path survives. So the principle of stationary action is the classical limit of a quantum sum. Quantum field theory is built almost entirely on Lagrangians for the same reason.

Does the Lagrangian have to be unique?

No. You can add the total time derivative of any function f(q, t) to L without changing the Euler-Lagrange equations: L → L + df/dt gives δS → δS + f(b) − f(a), and the boundary terms vanish because we hold endpoints fixed. This freedom shows up as "gauge" symmetry in field theory — different Lagrangians, same physics.

What does the Lagrangian look like for a relativistic particle?

For a free relativistic particle of rest mass m, L = −mc² √(1 − v²/c²). The action ∫L dt is then proportional to the proper time of the particle, so "least action" becomes "maximum proper time" — the particle takes the path that ages most. This is the foundation of the geodesic principle in general relativity, where worldlines extremize proper time in curved spacetime.