MathLabs

Analysis

Calculus of variations

Finds functions that minimize or maximize integral quantities, such as the shortest path or least time.

IntuitionWhat curve costs the least?

Ordinary calculus finds the input number that minimizes an output number. Calculus of variations asks a stranger question: among all possible functions satisfying some boundary condition, which whole function minimizes an integral built from it? A ray of light bends through glass so as to minimize travel time (Fermat's principle); a hanging chain settles into the shape that minimizes potential energy; a soap film stretched across a wire loop minimizes surface area. In every case, the unknown is not a number but an entire curve.

Interactive cubic curve widget illustrating a competitor path for a variational problem.
This cubic curve y=ax3+bx2+cx+dy=ax^3+bx^2+cx+d represents one candidate path competing to extremize a functional; drag the sliders to see how the curve's shape (and hence the integral built from it) changes as you move away from the true extremal.

SchoolThe shortest path and the most enclosed area

Definition: Functional

A functional is a rule that assigns a single number to an entire function, instead of to a single number. Calculus of variations studies functionals built as integrals of a function together with its derivative, and looks for the function that makes this integral as small (or as large) as possible.

J[y]=∫x0x1L(x,y,y′) dxJ[y] = \int_{x_0}^{x_1} L(x,y,y')\,dx

Here x0x_0 and x1x_1 are the fixed endpoints, y(x)y(x) is the unknown curve with given values at the endpoints, y′(x)y'(x) is its derivative, and LL (the Lagrangian) is a given function of three slots that encodes the quantity being accumulated — arc length, travel time, energy, and so on.

∂L∂y−ddx∂L∂y′=0\frac{\partial L}{\partial y}-\frac{d}{dx}\frac{\partial L}{\partial y'}=0
Three classic variational problems
ProblemFunctional / constraintOptimal curve
Shortest path (geodesic) in the planeminimize J[y]=∫1+(y′)2 dxJ[y]=\int\sqrt{1+(y')^2}\,dxa straight line
Brachistochrone (least time)minimize T[y]=∫0x11+(y′)22gy dxT[y]=\int_0^{x_1} \frac{\sqrt{1+(y')^2}}{\sqrt{2gy}}\,dxa cycloid
Isoperimetric (max area, fixed perimeter)maximize A=12∮(x dy−y dx)A=\frac12\oint (x\,dy - y\,dx) with fixed perimetera circle

UndergraduateNecessary conditions for an extremal

Let y(x)y(x) be a twice continuously differentiable function on [x0,x1][x_0,x_1] with fixed endpoint values y(x0)=y0y(x_0)=y_0, y(x1)=y1y(x_1)=y_1. If yy extremizes the functional J[y]=∫x0x1L(x,y,y′) dxJ[y] = \int_{x_0}^{x_1} L(x,y,y')\,dx among all such curves, then yy satisfies ∂L∂y−ddx∂L∂y′=0\frac{\partial L}{\partial y}-\frac{d}{dx}\frac{\partial L}{\partial y'}=0 for every x∈(x0,x1)x\in(x_0,x_1).

Why is it true?

This mirrors setting an ordinary derivative to zero at a minimum, but here the 'direction' we perturb in is not a single number but an entire admissible variation of the curve. Requiring the first-order change to vanish for every such variation forces the pointwise balance between the direct yy-dependence of LL and the y′y'-dependence, encoded exactly by this equation.

Proof

Fix an arbitrary smooth function η(x)\eta(x) with η(x0)=η(x1)=0\eta(x_0)=\eta(x_1)=0, and consider the one-parameter family of competitor curves yϵ(x)=y(x)+ϵ η(x)y_\epsilon(x) = y(x) + \epsilon\,\eta(x), all of which share the same endpoint values as yy. Define ϕ(ϵ)=J[yϵ]\phi(\epsilon) = J[y_\epsilon]; since yy is assumed to extremize JJ, the ordinary function ϕ\phi has a critical point at ϵ=0\epsilon=0, so ϕ′(0)=0\phi'(0)=0.

Differentiating under the integral sign, ϕ′(ϵ)=∫x0x1[∂L∂y η+∂L∂y′ η′]dx\phi'(\epsilon) = \int_{x_0}^{x_1} \left[ \frac{\partial L}{\partial y} \,\eta + \frac{\partial L}{\partial y'} \,\eta' \right] dx, where the partial derivatives of LL are evaluated along yϵy_\epsilon. Setting ϵ=0\epsilon=0 gives ∫x0x1[∂L∂y η+∂L∂y′ η′]dx=0\int_{x_0}^{x_1} \left[ \frac{\partial L}{\partial y} \,\eta + \frac{\partial L}{\partial y'} \,\eta' \right] dx = 0.

Integrate the second term by parts: ∫x0x1∂L∂y′ η′ dx=[∂L∂y′ η]x0x1−∫x0x1ddx∂L∂y′ η dx\int_{x_0}^{x_1} \frac{\partial L}{\partial y'} \,\eta'\,dx = \left[ \frac{\partial L}{\partial y'} \,\eta \right]_{x_0}^{x_1} - \int_{x_0}^{x_1} \frac{d}{dx}\frac{\partial L}{\partial y'} \,\eta\,dx. The boundary term vanishes because η(x0)=η(x1)=0\eta(x_0)=\eta(x_1)=0, leaving ∫x0x1[∂L∂y−ddx∂L∂y′]η dx=0\int_{x_0}^{x_1} \left[ \frac{\partial L}{\partial y} - \frac{d}{dx}\frac{\partial L}{\partial y'} \right] \eta\,dx = 0.

This integral vanishes for every admissible η\eta. By the fundamental lemma of the calculus of variations — if a continuous function integrates to zero against every such test function, the function itself must be identically zero — the bracketed quantity vanishes at every xx, which is exactly ∂L∂y−ddx∂L∂y′=0\frac{\partial L}{\partial y}-\frac{d}{dx}\frac{\partial L}{\partial y'}=0.

If the Lagrangian L=L(y,y′)L=L(y,y') has no explicit dependence on xx, then along any extremal y(x)y(x) the quantity L−y′∂L∂y′=CL - y' \frac{\partial L}{\partial y'} = C is constant.

Why is it true?

This is a conserved quantity, exactly analogous to conservation of energy: when the 'rules' LL do not change as we slide along xx, a specific combination of LL and y′y' stays fixed. It gives a first-order equation in place of the second-order Euler–Lagrange equation, which is often much easier to solve directly.

Proof

Define H(x)=L(y,y′)−y′ ∂L∂y′H(x) = L(y,y') - y'\,\frac{\partial L}{\partial y'} evaluated along an extremal y(x)y(x), and differentiate with respect to xx using the chain rule: dHdx=∂L∂yy′+∂L∂y′y′′−y′′ ∂L∂y′−y′ ddx∂L∂y′\frac{dH}{dx} = \frac{\partial L}{\partial y} y' + \frac{\partial L}{\partial y'} y'' - y''\,\frac{\partial L}{\partial y'} - y'\,\frac{d}{dx}\frac{\partial L}{\partial y'}.

The two terms containing y′′y'' cancel exactly, leaving dHdx=y′(∂L∂y−ddx∂L∂y′)\frac{dH}{dx} = y'\left( \frac{\partial L}{\partial y} - \frac{d}{dx}\frac{\partial L}{\partial y'} \right).

But y(x)y(x) is an extremal, so by the Euler–Lagrange equation the bracketed factor is identically zero along yy. Hence dHdx=0\frac{dH}{dx}=0 everywhere on the interval, which means H(x)=L−y′ ∂L∂y′H(x)=L-y'\,\frac{\partial L}{\partial y'} is constant, proving the claim.

UndergraduateReal-World Applications and Worked Examples

Calculus of variations underlies geodesics in general relativity and robot motion planning (shortest/least-cost path on a curved space), Fermat's principle in optics and lens design, minimal-surface soap films and architectural shell design, and optimal-control problems in economics and aerospace engineering (minimum-fuel trajectories). The two worked examples below derive the two most famous variational curves by hand.

Example: The brachistochrone problem

A bead slides without friction under gravity along a wire from the origin (0,0)(0,0) down to a lower point (x1,y1)(x_1,y_1) (taking yy positive downward). Among all wire shapes joining these two points, which one lets the bead arrive in the least time?

Solution

By conservation of energy, starting from rest at y=0y=0, the bead's speed at height yy satisfies v=2gyv=\sqrt{2gy}. Since speed is arc length per unit time, the total travel time is T[y]=∫0x11+(y′)22gy dxT[y]=\int_0^{x_1} \frac{\sqrt{1+(y')^2}}{\sqrt{2gy}}\,dx, using ds=1+(y′)2 dxds=\sqrt{1+(y')^2}\,dx.

The integrand L=1+(y′)22gyL=\frac{\sqrt{1+(y')^2}}{\sqrt{2gy}} depends on yy and y′y' but not explicitly on xx, so the Beltrami identity L−y′∂L∂y′=CL - y' \frac{\partial L}{\partial y'} = C applies directly. Computing ∂L∂y′=y′2gy1+(y′)2\frac{\partial L}{\partial y'}=\frac{y'}{\sqrt{2gy}\sqrt{1+(y')^2}} and simplifying L−y′∂L∂y′L-y'\frac{\partial L}{\partial y'} gives 12gy1+(y′)2=const\frac{1}{\sqrt{2gy}\sqrt{1+(y')^2}}=\text{const}, which rearranges to y[1+(y′)2]=ky\left[1+(y')^2\right]=k for some constant kk.

This first-order equation is solved by the substitution y′=cot⁡(θ/2)y'=\cot(\theta/2), which after integration yields the parametric family x=a(θ−sin⁡θ), y=a(1−cos⁡θ)x=a(\theta-\sin\theta),\ y=a(1-\cos\theta) with a=k/2a=k/2 — a cycloid, the curve traced by a point on the rim of a rolling circle.

So the fastest path is not the straight line: the cycloid initially drops more steeply than a straight line, trading extra distance for extra speed gained early, and this trade-off is exactly what the Euler–Lagrange/Beltrami machinery makes precise.

Example: Isoperimetric problem: maximum area for a fixed perimeter

Among all smooth simple closed curves in the plane with a given fixed perimeter L0L_0, which one encloses the largest area?

Solution

This is a constrained variational problem: maximize the area A=12∮(x dy−y dx)A=\frac12\oint (x\,dy - y\,dx) subject to the constraint that the perimeter ∮(x′)2+(y′)2 dt=L0\oint \sqrt{(x')^2+(y')^2}\,dt=L_0 is fixed, where the curve is parametrized by tt.

As with constrained optimization in ordinary calculus, introduce a Lagrange multiplier λ\lambda and extremize the combined functional A−λ⋅(perimeter)A-\lambda\cdot(\text{perimeter}) freely (no constraint), by applying the Euler–Lagrange equation separately to the x(t)x(t) and y(t)y(t) components.

Carrying out this variation shows that the curvature of an extremal curve must be constant along its entire length — a curve of constant curvature in the plane is precisely a circle. So among all closed curves of perimeter L0L_0, only the circle of radius r=L0/(2π)r=L_0/(2\pi) can be an extremal.

Since a circle of that radius indeed encloses area A=πr2=L02/(4π)A=\pi r^2=L_0^2/(4\pi), and no closed curve of the same perimeter can enclose more (this is the isoperimetric inequality), the circle is confirmed as the maximizer — matching the everyday observation that round shapes 'use' their boundary most efficiently.

In the Euler–Lagrange equation, what condition must y(x)y(x) satisfy for it to hold?

What is the shape of the brachistochrone, the curve of fastest descent under gravity?

For the functional J[y]=∫01(y′)2 dxJ[y]=\int_0^1 (y')^2\,dx with y(0)=0y(0)=0, y(1)=1y(1)=1, which curve does the Euler–Lagrange equation select?

Among all simple closed curves enclosing a fixed perimeter, which shape maximizes the enclosed area?

References

  1. I. M. Gelfand, S. V. Fomin (2000). Calculus of Variations
  2. Mark Kot (2014). A First Course in the Calculus of Variations
  3. Camillo De Lellis, Matteo Focardi (2023). The regularity theory for the Mumford-Shah functional on the plane · arXiv:2308.14660 [preprint, not peer-reviewed]