Lagrangian Mechanics
- Introductory Newtonian mechanics and multivariable calculus (program background)
- P.1.1 Waves & the Wave Equation
Newton tells you what happens at each instant: add up the forces, divide by the mass. Lagrange asks a stranger, deeper question: of all conceivable histories between two fixed moments, which one does nature actually choose? The answer — the path of stationary action — eliminates constraint forces, hands out conservation laws, and (as Feynman later showed) is the shadow of a quantum sum over every path at once. A cat stalking a sunbeam knew it all along.
Learning Objectives
After this lesson you will be able to:
- Reformulate mechanical problems in generalized coordinates, counting degrees of freedom and bypassing constraint forces.
- Derive the Euler–Lagrange equation from stationarity of the action via the calculus of variations.
- Construct Lagrangians and obtain equations of motion for the oscillator, the pendulum, and central potentials.
- Identify cyclic coordinates and extract conserved conjugate momenta — Noether's theorem in miniature.
- Explain why the action controls quantum amplitudes through the phase and the stationary-phase argument.
- Classify constraints as holonomic or non-holonomic and scleronomic or rheonomic, and state d'Alembert's principle.
- Derive conservation of energy, momentum and angular momentum from the homogeneity of time, the homogeneity of space and the isotropy of space.
Intuition
Newtonian mechanics is local and forceful: at every instant, tally the forces and integrate. It works, but for constrained systems it makes you compute forces you never cared about — the tension in a pendulum rod, the normal force from a wire — just to eliminate them again.
The Lagrangian view is global and economical. Assign every conceivable path between fixed endpoints a single number, the action . The physical path is the one where is stationary: wiggling the path changes only at second order. Constraint forces never appear (they do no work along allowed motions), any convenient coordinates work, and symmetries hand you conservation laws. Quantum mechanics will explain why nature grades paths this way: every path contributes an amplitude of phase , and only near the stationary path do the phases agree and add up.
Theory
Newton in one paragraph
For a particle of mass , Newton's second law is . A force is conservative if for some potential ; then energy is conserved: , so . This framework is complete in principle — the trouble is practical.
That energy calculation hides a contrast worth seeing once. Under a constant force the momentum grows at the fixed rate , but the kinetic energy grows at , which rises with the speed:
Interactive demo: Momentum vs kinetic energy under a constant force. Push with a constant force and compare what each second adds to momentum and to kinetic energy.
Where Newton gets awkward
A pendulum bob in Cartesian coordinates obeys , where the rod tension is an unknown constraint force: you must solve for it and then eliminate it, even though the motion is fully described by one angle . A bead on a bent wire is worse — the normal force changes direction along the wire. Newton forces you to (i) carry unknown constraint forces and (ii) work in coordinates that ignore the geometry. Both problems have one cure.
Generalized coordinates
A holonomic constraint is a relation among coordinates. A system of particles with independent holonomic constraints has degrees of freedom, and can be described by independent generalized coordinates — any variables that smoothly parametrize the allowed configurations: the pendulum's (), arc length along the wire, two angles for a double pendulum. Velocities are their time derivatives; the pair fixes the instantaneous state.
The action and the Euler–Lagrange equation
A functional assigns a number to a whole function. The action of a path between fixed endpoints , is
with the Lagrangian. Hamilton's principle: the physical path makes stationary, . To extract the consequence, deform the path: where is arbitrary and smooth with (endpoints pinned). Then is an ordinary function, and stationarity means for every . Differentiating under the integral with the chain rule,
Integrate the second term by parts:
so that
Now the fundamental lemma of the calculus of variations: if for every smooth vanishing at the endpoints, and is continuous, then . (If , continuity gives an interval where ; a smooth positive bump supported there makes the integral positive — contradiction.) Hence
one Euler–Lagrange equation per coordinate (for several , vary each independently).
Caution. In , the symbols and are independent slots of the function : differentiate treating as a variable in its own right, then evaluate along the trajectory. Only the outer is a total derivative along the motion. Conflating the two is the single most common Lagrangian error.
Stationary is all the principle asks for, and the word matters. Below, every path joins the same two endpoints for the oscillator ; bend one with the bumps and watch stay flat to first order at the true path. For a short trip every bump raises , so the true path is a minimum. Let the trip last longer than half a period, , and the bump lowers : the true path is then a saddle of the action, and still the path the particle takes.
Interactive demo: Least action, or stationary action?. Bend a path between fixed endpoints and watch the action: flat at the true path, and a saddle once T passes half a period.
recovers Newton
For a particle in a conservative potential, take . Then and , so Euler–Lagrange gives — exactly . Hamilton's principle with is Newtonian mechanics, repackaged.
Caution. is not a law of nature. It holds for velocity-independent potentials; a charged particle in a magnetic field needs the generalized potential , and dissipative forces like friction have no Lagrangian at all. What survives universally is Hamilton's principle itself — with the appropriate .
Classifying constraints
Generalized coordinates presupposed holonomic constraints. In general, constraints are sorted along two independent axes, and both matter later.
Holonomic or not. A constraint is holonomic when it is an equation among the coordinates and possibly time, ; each one removes a degree of freedom. A particle confined to the surface keeps two coordinates. Differentiating along the motion gives a relation among velocities, , but an integrable one: it is the time derivative of the holonomic equation. A non-holonomic constraint admits no such equation, and comes in two kinds:
- Non-integrable velocity constraints, . The standard example is a coin of radius rolling upright without slipping on a table. Its configuration needs four coordinates: the contact point , the heading and the rotation angle . Rolling imposes and , and these cannot be integrated into relations among : by rolling along suitable paths the coin reaches every configuration (E6). The velocities are restricted; the configurations are not, so no coordinate can be eliminated.
- Inequalities: molecules confined to a box, , or a particle sliding on the outside of a sphere, , which may fly off. They bind only on part of the motion, and the problem has to be solved piecewise.
Non-holonomic constraints need extra machinery (Lagrange multipliers, [Gold] §2.4). Every system in this term is holonomic.
Time-dependent or not. A constraint with no explicit time dependence is scleronomic: a bead on a fixed wire. One with explicit is rheonomic: a bead on a wire turned by a motor (Example 2 below), or a pendulum whose support is driven up and down. The distinction decides, in P.1.4, whether the Hamiltonian equals the energy.
Why constraint forces drop out. A virtual displacement is an infinitesimal change of configuration allowed by the constraints frozen at one instant . Ideal constraints, such as frictionless surfaces, rigid rods and rolling without slipping, exert forces that do no work in any virtual displacement: a normal force is perpendicular to every displacement along its surface. Newton's law , with split into applied and constraint parts, then collapses to d'Alembert's principle:
Expanding in independent , and using the two identities and , the acceleration term becomes , so
with the generalized force conjugate to . When the applied forces derive from a potential, , and this is the Euler–Lagrange equation for derived above from Hamilton's principle, now reached by a completely independent route ([Gold] §1.4). Note the word virtual: a moving constraint can do real work, as the motor turning the wire in Example 2 does, but never virtual work, because a virtual displacement freezes the constraint.
Three worked systems
Harmonic oscillator. . Euler–Lagrange: , i.e. with ; solution .
Here is an angular frequency; the cycles per second are . The damping slider goes beyond (friction has no Lagrangian, as the caution above warns), but it shows what the ideal oscillator's constant amplitude is being compared against:
Interactive demo: Mass on a spring. Change mass and damping and read ω, f and the amplitude envelope of a spring oscillator.
Simple pendulum (length , mass ). One generalized coordinate : , , so and :
This is the exact equation — no rod tension ever appeared. For small angles and the pendulum is an oscillator with .
Put the two systems side by side under one gravity slider. Hang the spring vertically and only shifts its equilibrium, leaving untouched; for the pendulum, gravity is the restoring force:
Interactive demo: One gravity slider, two oscillators. Change g and compare a hanging spring, whose beat never changes, with a pendulum, whose beat does.
Particle in a central potential (plane polar coordinates ). With ,
The equation says is conserved — the angular momentum (this is Kepler's second law: equal areas in equal times). This conserved is the seed of the quantum theory of angular momentum in P.6.1.
Conserving is not conserving : does not depend on , but written in and it depends on both. On a circular orbit at constant speed the angular momentum stays fixed while the linear momentum turns continuously:
Interactive demo: Momentum on a circle. Constant speed, turning momentum: compare the momentum vector at two points of a circular path.
Cyclic coordinates and conservation
Define the conjugate (canonical) momentum . If does not depend on some — a cyclic coordinate — Euler–Lagrange collapses to : the conjugate momentum of a cyclic coordinate is conserved. Free particle: cyclic, conserved. Central potential: cyclic, conserved. This is Noether's theorem in its simplest form — each continuous symmetry of (here, invariance under shifting ) produces a conservation law. In quantum mechanics the same logic returns as "observables commuting with the Hamiltonian are conserved" (1.1.3).
The full statement is worth having. Noether's theorem: if the action is unchanged by a continuous family of transformations ( unchanged, or changed only by a total time derivative), then some quantity is conserved along every solution. Shifting every position along a direction conserves the total momentum along ; rotating about an axis conserves the angular momentum about that axis; shifting time, , conserves the energy function . The hypothesis is a symmetry of the action. A transformation that only maps solutions to solutions, such as rescaling for the oscillator, whose equation of motion is linear, multiplies by and yields no conserved quantity. None of the three laws is automatic: each holds exactly as long as its symmetry does.
Interactive demo: One symmetry, one conserved quantity. Switch potentials under a moving particle and see momentum, angular momentum and energy conserved exactly when their symmetry holds.
The three classic symmetries, derived
Every isolated system has three symmetries, which follow from the properties classical mechanics assumes for space and time. Each can be turned into its conservation law by hand. Take particles with , and write , so that Euler–Lagrange reads .
Homogeneity of time → energy. If no instant is special, has no explicit time dependence. Along a motion, the chain rule and Euler–Lagrange give
With the energy function is conserved. To see that is the energy, use Euler's theorem on homogeneous functions: if , differentiating in at gives . When the constraints are scleronomic, is a homogeneous quadratic () in the velocities, so , and with a velocity-independent , . The bead on the rotating wire (Example 2) is the instructive exception: rheonomic, so is conserved but is not .
Homogeneity of space → momentum. If no place is special, shifting every particle by the same infinitesimal (, velocities unchanged) leaves unchanged. That is automatic when depends only on the separations . Then for every , so :
Since is the force on particle , the same line says the internal forces sum to zero. Newton's third law is a consequence of the homogeneity of space.
Isotropy of space → angular momentum. If no direction is special, rotating the whole system by an infinitesimal angle about , which moves positions and velocities, and , leaves unchanged. Using Euler–Lagrange and the cyclic rule ,
Since is arbitrary, the total angular momentum is conserved. (It is written here only to keep it apart from the Lagrangian ; P.1.4 and P.6 call it .)
These are the seven additive integrals of motion of an isolated system: the energy, three components of momentum and three of angular momentum, each the sum of its values over non-interacting parts ([LL] §§6–9). External fields remove exactly the laws whose symmetries they break. Near the Earth's surface gravity singles out the vertical, so and survive but does not (E1), and only survives. A fixed central force singles out a point, so is lost while all three components of survive (the central-potential example above).
Why the action matters for quantum mechanics
Feynman's path-integral formulation of quantum mechanics (plain statement — the machinery comes much later): a quantum particle going from to takes every path, and each path contributes a complex amplitude of unit magnitude and phase ; the total amplitude is . When , the phase spins wildly as the path is deformed, and contributions from neighboring paths cancel — except near a path where is stationary, where nearby paths share the same phase and interfere constructively. Classical mechanics is the stationary-phase limit of quantum mechanics: Hamilton's principle is not an axiom but an interference pattern. Note has units of action (J·s) — it is precisely the scale that decides whether counts as "large". The waves being superposed here are amplitudes over paths, the same superposition logic as P.1.1.
Worked Examples
Example 1 — Atwood's machine
Masses kg and kg hang from an inextensible string over a massless, frictionless pulley. One degree of freedom: let be the downward displacement of (so rises by ). Then and , so
Hence m/s². The string tension — which Newton's approach must introduce and eliminate — never appeared. (If wanted afterwards: N.)
Example 2 — Bead on a uniformly rotating wire
A bead slides without friction on a straight horizontal wire forced to rotate at constant angular speed about a vertical axis. Using the distance from the axis, the bead's position is , so and : . Euler–Lagrange: , i.e. — the "centrifugal" term emerged automatically from the kinematics. With , : . For rad/s, m: m — the bead is flung outward. Its kinetic energy grows (the motor turning the wire does work): energy is not conserved here, a subtlety the Hamiltonian framework will diagnose cleanly in P.1.4.
Below, the bead spirals out while its energy climbs. The flat line beside it is , conserved because has no explicit ; P.1.4 will call it the Hamiltonian.
Interactive demo: Conserved, but not the energy. Spin a wire with a bead on it: the Hamiltonian stays constant while the energy climbs, because the motor does work.
Hands-on (Python)
import numpy as np
# --- The true path is stationary: discretized action for the oscillator ---
# m = k = 1, endpoints x(0) = 0, x(Tf) = 1 with Tf = 1 (< pi => a minimum).
# True solution of xdd = -x through these endpoints: x(t) = sin(t)/sin(1).
m = k = 1.0; Tf = 1.0; N = 2001
t = np.linspace(0.0, Tf, N); dt = t[1] - t[0]
def action(x):
v = np.diff(x)/dt # velocities on interval midpoints
xm = 0.5*(x[1:] + x[:-1]) # positions on interval midpoints
return np.sum(0.5*m*v**2 - 0.5*k*xm**2)*dt
x_true = np.sin(t)/np.sin(1.0)
S0 = action(x_true)
print(f"S_true = {S0:.4f}") # 0.3210 (analytic: sin(2)/(4 sin^2 1))
# one random smooth perturbation, exactly zero at both endpoints:
rng = np.random.default_rng(0)
modes = np.arange(1, 6)
eta = (rng.normal(size=5)[:, None]*np.sin(np.outer(modes, np.pi*t/Tf))).sum(0)
for eps in (0.01, 0.05, 0.10, 0.20):
dS = action(x_true + eps*eta) - S0
print(f"eps = {eps:4.2f} S - S_true = {dS:+.6f} dS/eps^2 = {dS/eps**2:.3f}")
# Expected: every dS > 0 and dS/eps^2 = 27.268 for ALL eps -- the first-order
# variation vanishes identically: the true path is stationary (here a minimum).import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import solve_ivp
# --- Full pendulum vs small-angle solution ---
g, ell = 9.81, 1.0
w0 = np.sqrt(g/ell) # small-angle frequency, period 2.006 s
rhs = lambda t, y: [y[1], -(g/ell)*np.sin(y[0])]
t = np.linspace(0, 10, 2000)
fig, axes = plt.subplots(2, 1, figsize=(8, 6))
for th0, ax in zip((0.10, 2.50), axes):
sol = solve_ivp(rhs, (0, 10), [th0, 0.0], t_eval=t, rtol=1e-9)
ax.plot(t, sol.y[0], label="exact")
ax.plot(t, th0*np.cos(w0*t), "--", label="small-angle")
ax.set(title=f"theta0 = {th0} rad", ylabel="theta (rad)"); ax.legend()
axes[1].set_xlabel("t (s)"); plt.tight_layout(); plt.show()
# Expected: theta0 = 0.10 -> the two curves are indistinguishable.
# theta0 = 2.50 -> exact period ~ 3.29 s (elliptic integral), so the exact
# curve drifts steadily out of phase with the 2.006 s small-angle cosine.Exercises
E1 (easy). Write the Lagrangian of a projectile in a vertical plane, , derive both equations of motion, and identify the conserved momentum.
Solution
Euler–Lagrange: and , i.e. , — projectile motion. is cyclic, so is conserved (horizontal translation symmetry).
E2 (easy). A mass hangs from a vertical spring; let be the downward displacement from the spring's natural length, so . Find the motion.
Solution
Euler–Lagrange: . Substituting : — simple harmonic motion at about the shifted equilibrium . Gravity relocates the center of oscillation but leaves the frequency alone.
E3 (medium). Show that for any smooth yields the same Euler–Lagrange equations as .
Solution
. The added term depends only on the fixed endpoints, so it is the same constant for every admissible path: , and the stationary paths — hence the equations of motion — coincide. The Lagrangian of a given system is therefore not unique (a "gauge" freedom).
E4 (medium). Use the Euler–Lagrange equation to prove the shortest path between two points in a plane is a straight line, starting from the arc-length functional .
Solution
Here plays "time" and has no explicit : is cyclic, so is constant. That forces , i.e. — a straight line. The variational machinery is indifferent to what the independent variable means physically.
E5 (hard). A block of mass slides on the frictionless face (angle ) of a wedge of mass that itself slides on a frictionless floor. Find the accelerations of both.
Solution
Coordinates: wedge position ; block displacement down the incline. The block's position is , so
is cyclic: (total horizontal momentum), so . The equation: . Substituting :
Checks: gives , ✓. For kg, kg, : m/s², m/s². Two Newtonian constraint forces (normal forces on two surfaces) were never computed.
E6 (medium). Classify each constraint as holonomic or non-holonomic and as scleronomic or rheonomic, and give the number of degrees of freedom where that makes sense: (a) a bead on a fixed circular hoop; (b) a bead on a circular hoop spinning at constant about its vertical diameter; (c) a pendulum whose string is drawn up through a hole at a constant rate, ; (d) a particle sliding on the outside of a fixed sphere of radius ; (e) the upright coin rolling without slipping. For (e), show that every configuration can be reached, so the rolling conditions cannot be integrated.
Solution
(a) Holonomic (, ), scleronomic; one degree of freedom, the angle on the hoop. (b) Holonomic, rheonomic: the hoop's plane is at azimuth , which contains explicitly. One degree of freedom, the polar angle ; its is conserved but is not the energy, just like the rotating wire of Example 2. (c) Holonomic, rheonomic (); one degree of freedom. (d) The inequality is non-holonomic. While the particle is on the sphere it acts as (two degrees of freedom); it leaves where the normal force needed to hold it would turn negative, and then it has three. The motion must be solved piecewise. (e) Non-holonomic and scleronomic. To see non-integrability: rolling along a suitable curve brings the contact point to any with any heading . Then roll once around a full circle of radius : , and return to their values, while advances by , which can be anything since is free. Every configuration is therefore reachable, so no relation restricts them: four coordinates are needed, though at any instant only two velocities ( and ) are free.
Checkpoint
- What is a generalized coordinate, and which two Newtonian headaches does it cure?
- Sketch the derivation of the Euler–Lagrange equation. Where exactly is used?
- When is valid, and what is a standard counterexample?
- What is a cyclic coordinate, and what conservation law follows? Give two examples.
- In the path-integral picture, why do classical paths dominate when ?
- Why does a non-holonomic constraint not reduce the number of generalized coordinates? What does "virtual" mean in d'Alembert's principle?
- Which symmetry gives which conservation law, and what extra condition makes the conserved equal to ?
Answers
- Any variable smoothly parametrizing allowed configurations (one per degree of freedom). It eliminates constraint forces and lets you work in coordinates adapted to the geometry.
- Perturb , expand to first order, integrate the term by parts, and invoke the fundamental lemma. The endpoint conditions kill the boundary term from the integration by parts.
- For velocity-independent (conservative) potentials. Counterexample: magnetic forces, which need ; friction has no Lagrangian.
- A coordinate absent from ; its conjugate momentum is conserved. Free particle ( → linear momentum); central potential ( → angular momentum ).
- Each path contributes ; away from stationary points of the phase varies rapidly between neighboring paths and contributions cancel, while paths near the stationary (classical) one share a phase and add constructively.
- It restricts velocities, not configurations: every configuration stays reachable (the rolling coin), so no coordinate can be eliminated. A virtual displacement is one allowed by the constraints frozen at a single instant; ideal constraint forces do no work in such displacements, even when a moving constraint does real work.
- Homogeneity of time gives energy (the conserved ), homogeneity of space gives momentum, isotropy of space gives angular momentum. needs scleronomic constraints (so is quadratic in the velocities, by Euler's theorem) and a velocity-independent .
Further Reading
- [Gold] Goldstein, Poole & Safko, Ch. 1–2 — constraints, generalized coordinates, and variational principles; the definitive treatment.
- [LL] Landau & Lifshitz, Mechanics, §§1–9 — the principle of least action and the conservation laws derived from the symmetries of space and time, famously compact.
- [Sha] Shankar, §2.1 — the principle of least action, written with quantization in mind.
- [Sak] Sakurai & Napolitano, §2.6 — propagators and Feynman path integrals: made precise.
← Prev: Waves & the Wave Equation · Up: Pre-Term · Next: Hamiltonian Mechanics →