Training Classical Mechanics: Lagrangian & Hamiltonian Formulations Calculus of Variations & the Euler-Lagrange Equation
2 / 10

Calculus of Variations & the Euler-Lagrange Equation

42 min Classical Mechanics: Lagrangian & Hamiltonian Formulations

Calculus of Variations & the Euler-Lagrange Equation

The calculus of variations asks not "what value of $x$ minimises $f(x)$?" but "what function $y(x)$ extremises the functional $I[y]=\int_a^b L(x,y,y')\,dx$?" A functional maps an entire function to a number; the Euler-Lagrange equation is the analogue of setting a gradient to zero. This calculus underlies every variational principle in physics: Fermat's principle of least time, Hamilton's principle of stationary action, and the geodesic equations of general relativity all emerge from the same mathematical structure.

The derivation begins by perturbing the candidate extremal path: $y_\epsilon(x)=y(x)+\epsilon\eta(x)$, where $\eta(a)=\eta(b)=0$ is an arbitrary variation vanishing at the endpoints. Requiring $dI/d\epsilon\big|_{\epsilon=0}=0$ for all such $\eta$ and integrating by parts yields the Euler-Lagrange equation: $$\frac{\partial L}{\partial y}-\frac{d}{dx}\frac{\partial L}{\partial y'}=0.$$ This is an ordinary differential equation (generally second order) whose solutions are the stationary curves of $I[y]$.

Several important special cases simplify the equation. If $L$ does not depend explicitly on $x$, there is a first integral: the Beltrami identity $L-y'\frac{\partial L}{\partial y'}=\text{const}$, reducing the problem to a first-order ODE. If $L$ does not depend on $y$, then $\partial L/\partial y'=\text{const}$ immediately. These conservation laws are the variational precursors of Noether's theorem.

Definition — Functional

A functional $I[y]=\int_a^b L(x,y(x),y'(x))\,dx$ maps a function $y$ to a real number. The integrand $L(x,y,y')$ is called the Lagrangian density (or simply the Lagrangian) of the variational problem.

Theorem — Euler-Lagrange Equation

A smooth function $y(x)$ with fixed endpoints is a stationary point of $I[y]$ if and only if it satisfies $$\frac{\partial L}{\partial y}-\frac{d}{dx}\left(\frac{\partial L}{\partial y'}\right)=0.$$ If $L$ has no explicit $x$ dependence, the Beltrami identity $L-y'L_{y'}=C$ is a first integral.

Example 1: Shortest Path in the Plane

Minimise arc length $I[y]=\int_a^b\sqrt{1+y'^2}\,dx$. Here $L=\sqrt{1+y'^2}$ is independent of $y$, so $\partial L/\partial y'=y'/\sqrt{1+y'^2}=C$. This gives $y'=\text{const}$, hence $y=mx+b$ — the straight line, confirming our geometric intuition.

Example 2: Brachistochrone

Find the curve of fastest descent under gravity from $(0,0)$ to $(x_1,y_1)$. The travel time functional has $L=\sqrt{(1+y'^2)/(2gy)}$. Since $L$ has no explicit $x$, the Beltrami identity gives $y(1+y'^2)=\text{const}\equiv 2a$. Parametrically: $x=a(\theta-\sin\theta)$, $y=a(1-\cos\theta)$ — a cycloid, one of the most celebrated results in the calculus of variations.

Example 3: Euler-Lagrange for the Harmonic Oscillator

Take $L=\frac{1}{2}m\dot{q}^2-\frac{1}{2}kq^2$ (kinetic minus potential energy). The Euler-Lagrange equation is $$\frac{\partial L}{\partial q}-\frac{d}{dt}\frac{\partial L}{\partial\dot{q}} = -kq - m\ddot{q} = 0,$$ recovering Newton's law $m\ddot{q}+kq=0$ for the harmonic oscillator. This is the paradigm for Lagrangian mechanics.

Example 4: Catenary

A uniform chain of length $\ell$ hangs between two fixed points. Minimising potential energy $V=\rho g\int y\,ds=\rho g\int y\sqrt{1+y'^2}\,dx$ subject to the length constraint $\int\sqrt{1+y'^2}\,dx=\ell$ (handled by a Lagrange multiplier $\lambda$) yields via the Beltrami identity $$y=a\cosh\frac{x-x_0}{a},\quad a=\lambda/(\rho g).$$ The catenary shape arises in suspension bridges, soap films, and power-line sag.

Practice Problems

  1. Derive the Euler-Lagrange equation from first principles by computing $dI/d\epsilon|_{\epsilon=0}$ and integrating by parts.
  2. Apply the Euler-Lagrange equation to $L=\frac{1}{2}(y'^2 - y^2)$ and identify the resulting ODE and its general solution.
  3. Use the Beltrami identity to find the extremal of $I[y]=\int_1^2 \frac{\sqrt{1+y'^2}}{x}\,dx$ (the surface of revolution with minimum area).
  4. Show that for $L=L(y,y')$ with no explicit $x$, the function $H=y'\partial L/\partial y'-L$ is constant along any extremal.
  5. Find the curve $y(x)$ from $(0,0)$ to $(1,1)$ that minimises $I[y]=\int_0^1 (y'^2+2yy')\,dx$ and verify your answer satisfies the endpoint conditions.
Show Answer Key

1. Let $y_\epsilon = y + \epsilon\eta$ with $\eta(a)=\eta(b)=0$. $\frac{d}{d\epsilon}I[y_\epsilon]\big|_0 = \int_a^b (\frac{\partial L}{\partial y}\eta + \frac{\partial L}{\partial y'}\eta')dx$. Integration by parts on the second term: $= \int_a^b [\frac{\partial L}{\partial y} - \frac{d}{dx}\frac{\partial L}{\partial y'}]\eta\,dx = 0$ for all $\eta$. By the fundamental lemma, $\frac{\partial L}{\partial y} - \frac{d}{dx}\frac{\partial L}{\partial y'} = 0$.

2. $\frac{\partial L}{\partial y} = -y$, $\frac{\partial L}{\partial y'} = y'$. EL: $-y - y'' = 0$, i.e., $y'' + y = 0$. General solution: $y(x) = A\cos x + B\sin x$.

3. Beltrami identity: $L - y'L_{y'} = C$. With $L = \sqrt{1+y'^2}/x$: $\frac{1}{x\sqrt{1+y'^2}} = C$. So $x\sqrt{1+y'^2} = 1/C = a$. Solving: $x = a\cosh((y-b)/a)$ — a catenary, giving the catenoid (minimal surface of revolution).

4. $\frac{\partial L}{\partial x} = 0$ (no explicit $x$). EL gives $\frac{d}{dx}(y'L_{y'} - L) = -\frac{\partial L}{\partial x} = 0$. So $H = y'\frac{\partial L}{\partial y'} - L$ is constant along any extremal. This is the Beltrami identity / first integral.

5. EL: $\frac{\partial}{\partial y}(2yy') - \frac{d}{dx}(2y' + 2y) = 2y' - 2y'' - 2y' = -2y'' = 0$, so $y'' = 0$, giving $y = ax+b$. With $y(0)=0$, $y(1)=1$: $y(x) = x$. Verify: $I[y=x] = \int_0^1(1+2x)dx = 1+1=2$.