← Home · Mechanics and everyday physics · Newton's Principia · Hamiltonian mechanics → · 🇩🇰 Dansk

Lagrangian mechanics – nature chooses the least action

Newton writes down forces and adds them as vectors. Joseph-Louis Lagrange did something quite different: he wrote down a single scalar function – the difference between kinetic and potential energy – and let the equations of motion follow from it. It is the method physicists use for everything from spinning tops to the Standard Model. Here are the theory, the classic examples and three interactive simulations.

The idea: one function instead of many forces

For a ball sliding in a bowl, a bead on a hoop or a double pendulum, Newton's method is laborious: you have to find all the forces – including the constraint forces from the bowl, the hoop and the rods, which you do not really care about – and then eliminate them again. Lagrange skips the constraint forces. You choose some generalised coordinates $q_1, q_2, \dots$ that suit the problem (an angle, an arc length, a distance) and write down the Lagrangian:

$$L(q,\dot q,t) \;=\; T \;-\; V$$

where $T$ is the kinetic and $V$ the potential energy, both expressed in terms of $q$ and $\dot q = \mathrm dq/\mathrm dt$. The motion follows from a variational principle, Hamilton's principle: of all conceivable paths from $q(t_1)$ to $q(t_2)$, nature chooses the one that makes the action

$$S[q] \;=\; \int_{t_1}^{t_2} L\big(q(t),\dot q(t),t\big)\,\mathrm dt$$

stationary – in practice almost always least. It is a global statement about the whole path, not a local statement about the acceleration at a particular instant. Yet it gives exactly the same motions as Newton's laws.

Least action – try it yourself

A ball is thrown straight up and lands at the same spot after $T = 2$ s. Start and finish are fixed. Drag the curve to give the ball a different path in time – higher, lower, with bumps – and watch the action $S = \int (\tfrac12 m\dot q^2 - mgq)\,\mathrm dt$ change. Then press "Let nature choose": the curve slides down the hill of action and ends as the parabola Newton would have calculated. No force or acceleration enters the calculation – only the energies along the path.

Drag the curve with your mouse or finger
Try it yourself.
  1. Press "Straight line". The ball lies still on the ground for 2 s. Why is that not a solution? (It breaks no boundary condition!)
  2. Can you drag the curve so that $S$ becomes smaller than for the true parabola? Try higher and lower.
  3. "Too high a throw" spends longer high up. Which term in $S$ penalises that – and which term penalises the ball having to move fast?

The compromise is the whole secret. The $-V$ term would like the ball as high as possible for as long as possible; the $T$ term would like to avoid high speeds. The parabola is the path on which these two wishes balance at every single moment – and that balance is precisely Newton's $m\ddot q = -mg$.

The Euler–Lagrange equation

Let $q(t)$ be the true path and consider a neighbouring path $q(t)+\varepsilon\,\eta(t)$ with $\eta(t_1)=\eta(t_2)=0$. That $S$ is stationary means $\mathrm dS/\mathrm d\varepsilon = 0$ at $\varepsilon = 0$:

$$\frac{\mathrm dS}{\mathrm d\varepsilon}\bigg|_0=\int_{t_1}^{t_2}\Big(\frac{\partial L}{\partial q}\,\eta+\frac{\partial L}{\partial \dot q}\,\dot\eta\Big)\mathrm dt =\int_{t_1}^{t_2}\Big(\frac{\partial L}{\partial q}-\frac{\mathrm d}{\mathrm dt}\frac{\partial L}{\partial \dot q}\Big)\eta\,\mathrm dt = 0 .$$

The second equality is integration by parts; the boundary term vanishes because $\eta$ is zero at the end points. Since $\eta(t)$ is arbitrary, the bracket must vanish everywhere. This gives one equation for each coordinate:

$$\boxed{\;\frac{\mathrm d}{\mathrm dt}\frac{\partial L}{\partial \dot q_i}-\frac{\partial L}{\partial q_i}=0\;}\qquad i=1,\dots,n$$

For a particle in a potential, $L=\tfrac12 m\dot x^2 - V(x)$, so $\partial L/\partial\dot x = m\dot x$ and $\partial L/\partial x = -V'(x)$. The equation becomes $m\ddot x = -V'(x)$: Newton's second law. The quantity $p_i = \partial L/\partial\dot q_i$ is called the generalised momentum, and $\partial L/\partial q_i$ the generalised force. If $q$ is an angle, $p$ is an angular momentum and the "force" a torque.

The method works in any coordinates – polar, spherical, the angles of a linkage – because $S$ is a scalar that does not depend on how the path is described. Newton's equations, by contrast, have to be rewritten with fictitious forces every time you change to curvilinear or rotating coordinates.

Worked examples

1. The simple pendulum

Coordinate: the angle $\theta$ from the vertical. The bob has speed $\ell\dot\theta$ and height $-\ell\cos\theta$:

$$L=\tfrac12 m\ell^2\dot\theta^2+mg\ell\cos\theta .$$

$\partial L/\partial\dot\theta = m\ell^2\dot\theta$ and $\partial L/\partial\theta=-mg\ell\sin\theta$ give

$$\ddot\theta=-\frac{g}{\ell}\sin\theta .$$

The tension in the string never appeared. For small swings $\sin\theta\approx\theta$, and the period is $2\pi\sqrt{\ell/g}$.

2. Atwood's machine

Two masses $m_1$ and $m_2$ over a pulley. One coordinate: $x$, the distance $m_1$ has descended.

$$L=\tfrac12(m_1+m_2)\dot x^2+(m_1-m_2)gx$$ $$\Rightarrow\;(m_1+m_2)\ddot x=(m_1-m_2)g .$$

The string tension, which Newton had to eliminate from two equations, is gone from the start. If you want it, you can introduce it as a Lagrange multiplier.

3. A planet in a central field

Polar coordinates $r,\varphi$ in the orbital plane:

$$L=\tfrac12 m(\dot r^2+r^2\dot\varphi^2)+\frac{GMm}{r} .$$

$\varphi$ does not appear in $L$ (it is cyclic), so $p_\varphi=mr^2\dot\varphi$ is constant: angular momentum is conserved – Kepler's second law in one line (compare Newton's Prop. 1). The radial equation is $m\ddot r = mr\dot\varphi^2-GMm/r^2$, where the centrifugal term appears all by itself.

4. A charged particle in a magnetic field

Lagrange's method reaches beyond mechanics. For a charge $e$ in an electromagnetic field with potentials $\phi$ and $\mathbf A$,

$$L=\tfrac12 m\dot{\mathbf r}^2-e\phi+e\,\dot{\mathbf r}\cdot\mathbf A ,$$

and the Euler–Lagrange equations give the Lorentz force $m\ddot{\mathbf r}=e(\mathbf E+\dot{\mathbf r}\times\mathbf B)$. The generalised momentum is $\mathbf p = m\dot{\mathbf r}+e\mathbf A$ – not $m\dot{\mathbf r}$. This matters in Hamiltonian mechanics and in quantum mechanics.

The bead on the rotating hoop – spontaneous symmetry breaking

A bead slides without friction on a vertical hoop of radius $R$, and the hoop is spun about its vertical diameter with angular velocity $\omega$. With $\theta$ the angle from the bottom, the bead has velocity components $R\dot\theta$ along the hoop and $\omega R\sin\theta$ around the axis:

$$L=\tfrac12 mR^2\big(\dot\theta^2+\omega^2\sin^2\theta\big)+mgR\cos\theta \quad\Rightarrow\quad \ddot\theta=\sin\theta\Big(\omega^2\cos\theta-\frac gR\Big).$$

The equation corresponds to motion in an effective potential $U(\theta)=-mgR\cos\theta-\tfrac12 mR^2\omega^2\sin^2\theta$. Below the critical angular velocity $\omega_c=\sqrt{g/R}$ the bottom is the only stable equilibrium. Above $\omega_c$ the bottom becomes unstable, and two new equilibria appear at $\cos\theta_0 = g/(R\omega^2)$ – one to the right, one to the left. The hoop is symmetric, but the bead must choose a side: a spontaneous symmetry breaking, the same mathematics as in a ferromagnet below the Curie temperature and in the Higgs mechanism.

Drag: rotate · pinch/scroll: zoom
Try it yourself. The graph at the top right shows the effective potential $U(\theta)$ and the bead's position.
  1. Start with $\omega = 2$ rad/s. Where does the bead end up? Turn slowly up past $\omega_c \approx 3.13$ rad/s and watch the potential change shape from one valley to two.
  2. Set $\omega = 5$ rad/s. Does the bead's angle match $\theta_0=\arccos\!\big(g/(R\omega^2)\big)$? Which side does it choose – and what decides it?
  3. Switch friction off. Which quantity is now conserved? (Hint: not the energy $T+V$ – the hoop's motor does work.)

The double pendulum – four lines of Lagrange, infinite complexity

Two rigid pendulums hung one below the other have two coordinates, $\theta_1$ and $\theta_2$. The lower bob's velocity is the vector sum of two motions, so the kinetic energy acquires a coupling term:

$$L=\tfrac12(m_1+m_2)\ell_1^2\dot\theta_1^2+\tfrac12 m_2\ell_2^2\dot\theta_2^2+m_2\ell_1\ell_2\dot\theta_1\dot\theta_2\cos(\theta_1-\theta_2) +(m_1+m_2)g\ell_1\cos\theta_1+m_2g\ell_2\cos\theta_2 .$$

The two Euler–Lagrange equations cannot be solved analytically, but they can be integrated numerically (here with fourth-order Runge–Kutta). For small swings the motion is regular – a mixture of two normal modes, as in the coupled pendulums. For large swings it becomes chaotic: two pendulums that start with an angular difference of a millionth of a radian keep together for a few seconds and then part completely. The separation grows exponentially, $|\Delta\theta|\propto e^{\lambda t}$, where $\lambda$ is the Lyapunov exponent. The motion is fully deterministic – and yet unpredictable.

Drag: rotate · pinch/scroll: zoom
Try it yourself. The graph shows $\log_{10}$ of the angular difference between the two pendulums.
  1. Initial angle 120°: after how many seconds can you see a difference between the pendulums with the naked eye? What does the graph look like until then?
  2. Initial angle 15°: does the difference grow now? What does that mean for whether the motion is predictable?
  3. Make Δθ ten times smaller. How much longer do the pendulums stay together? (This is why weather forecasts cannot reach more than a couple of weeks ahead.)

Noether's theorem: symmetries give conservation laws

In 1918 Emmy Noether showed that every continuous symmetry of the action gives a conserved quantity. The simplest case can be seen directly in the Euler–Lagrange equation: if $q_i$ does not appear in $L$, then $\partial L/\partial q_i=0$, and $p_i=\partial L/\partial\dot q_i$ is constant.

Symmetry of $L$Conserved quantityExample
Translation in spaceMomentum $\mathbf p$The rocket and the skaters on the Principia page
Rotation about an axisAngular momentum $\mathbf L$The law of areas, the gyroscope, the pirouette
Translation in time ($L$ does not depend on $t$)Energy $E=\sum p_i\dot q_i-L$The pendulum, the double pendulum without friction
Rotation at constant $\omega$ (the bead)Jacobi integral $\tfrac12mR^2(\dot\theta^2-\omega^2\sin^2\theta)-mgR\cos\theta$The bead on the hoop
Phase symmetry in quantum field theoryElectric chargeQuantum electrodynamics

The third row explains why energy is conserved: the laws of physics are the same today as yesterday. The fourth shows that for the bead on the driven hoop it is not $T+V$ that is conserved but another combination – the energy as seen from the rotating hoop. The Lagrangian that governs the gyroscope and the tippe top also has two cyclic angles, and their conserved momenta explain the precession.

History: from Fermat to Feynman

Exercises

  1. A mass $m$ hangs on a spring with spring constant $k$. Write down $L$ and show that the period is $2\pi\sqrt{m/k}$.
  2. A ball of radius $r$ rolls without slipping down a slope of inclination $\alpha$. Use the distance $s$ as coordinate (the ball's rotation angle is $s/r$) and show that $\ddot s = \tfrac57 g\sin\alpha$.
  3. A pendulum hangs from a trolley that can run freely on a horizontal track. Use the trolley's position $x$ and the pendulum angle $\theta$ as coordinates. Which coordinate is cyclic, and which conserved quantity corresponds to it?
  4. Show for the bead on the hoop that the Jacobi integral in the table is conserved (multiply the equation of motion by $\dot\theta$ and integrate).

Sources and further reading

Related pages: Least time and least action · Newton's Principia · Hamiltonian mechanics · Quaternions · The gyroscope and the tippe top · Coupled pendulums · The swing.