Calculus of Variations and the Variational Derivative

In June 1696 Johann Bernoulli threw down a challenge "to the sharpest mathematicians in the whole world": a bead slides without friction from point A to a lower point B — what shape of wire gets it there fastest? The straight line is shortest, but not quickest; a curve that dives steeply at first buys speed early and spends it on the flat. Newton solved the problem overnight; Leibniz, l'Hôpital, and both Bernoullis solved it too. What none of them yet had was a machine for such questions — because the unknown is not a number but an entire function, and ordinary calculus, which extremizes over points, has no handle on it. Building that machine is the business of the calculus of variations. The move is audacious: treat every value y(x)y(x) along the curve as its own coordinate, so that a path becomes a point in an infinite-dimensional space, and demand that the quantity you care about be stationary against every possible wiggle. Three tools (a one-parameter deformation, an integration by parts, one sharp lemma) convert that demand into a differential equation valid at every point: the Euler–Lagrange equation. Master this machinery once and you own theoretical physics' master key. Hamilton's principle, geodesics, Fermat's optics, minimal surfaces, field theory — each is this calculation with a different integrand. Nature, it turns out, is an optimizer; this is the mathematics of asking what she optimizes.

Key takeaways
  • A functional assigns a number to an entire function — J[y]=∫f(y,y′,x) dxJ[y]=\int f(y,y',x)\,\mathrm{d}x; the calculus of variations finds the functions that make JJ stationary.
  • Perturb the path by y→y+ϵ η(x)y \to y + \epsilon\,\eta(x) with η\eta vanishing at the endpoints; stationarity means δJ=0\delta J = 0 for every admissible wiggle η\eta.
  • Integration by parts plus the fundamental lemma turn that integral condition into a pointwise one: the Euler–Lagrange equation.
  • The variational derivative δJ/δy(x)\delta J/\delta y(x) is the continuum analogue of a gradient component; setting it to zero is the EL equation, and the same object runs field theory.
  • Two shortcuts do most exam work: ff free of yy conserves ∂f/∂y′\partial f/\partial y'; ff free of xx conserves f−y′ ∂f/∂y′f - y'\,\partial f/\partial y' (Beltrami — energy conservation in disguise).
  • Key idea: Stationarity of a functional J[y]=∫f(y,y′,x) dxJ[y]=\int f(y,y',x)\,\mathrm{d}x under fixed-endpoint variations y→y+ϵηy\to y+\epsilon\eta forces, via integration by parts and the fundamental lemma, the pointwise Euler–Lagrange equation ∂f∂y−ddx∂f∂y′=0\frac{\partial f}{\partial y}-\frac{\mathrm{d}}{\mathrm{d}x}\frac{\partial f}{\partial y'}=0 — the variational derivative set to zero.

Where this lives today

Every fundamental theory in the current canon is a stationary-action statement. The Standard Model is a Lagrangian density plus the demand δS/δϕ=0\delta S/\delta\phi=0 for each field; general relativity is the Einstein–Hilbert action varied with respect to the metric; the path integral is organized around the classical extremal, with ℏ\hbar measuring how far fluctuations stray. A proposal for new physics is an integrand ff — this machinery does the rest. The computational world runs on the same engine. The finite-element method discretizes an energy functional and extremizes over nodal values. Optimal-control software that lands reusable rockets and plans robot trajectories solves Euler–Lagrange-type systems (in Pontryagin form) in real time. And training a neural network is ordinary gradient descent in a finite-dimensional parameter space: backpropagation computes ∂L/∂θ\partial L/\partial\theta for the weights and biases and steps along −∂L/∂θ-\partial L/\partial\theta, not along a functional derivative −δJ/δy-\delta J/\delta y. The function-space version is a real but separate construction — functional gradient descent, as in gradient boosting or the infinite-width kernel limit — and there the variational derivative genuinely is the object being descended.

The physical picture

Picture ordinary calculus: to find the lowest point of a landscape f(x1,…,xn)f(x_1,\dots,x_n) you demand that the slope vanish along every coordinate direction. The calculus of variations does exactly this, but the "landscape" is the value of a functional plotted over the infinite-dimensional space of all paths, and the "coordinate directions" are the independent wiggles η(x)\eta(x) you can add at each point. A path is stationary when wiggling it in any allowed way produces no first-order change in JJ.

Figure
The variational setup — one extremal among all the paths that share its endpoints
A B the extremal y(x) rival paths y(x) + εη(x) — same endpoints wiggle η(x): free in the middle, zero at the ends

Read the figure as a contest: every curve from A to B is a legal competitor, and JJ scores each with a single number. The blue extremal is the path whose score does not change, to first order, under any multiple of any wiggle η\eta. The red bump underneath is the wiggle itself — pinned to zero at both ends, free in between; that freedom is the whole source of the physics. The payoff is visible in the problem that started the field. Between the same two points, the straight wire is shortest — and loses:

Figure
The brachistochrone — the straight line is shorter, the cycloid is faster
A (start, at rest) B (1.0 m across, 0.6 m down) straight ramp: length 1.166 m, time 0.680 s cycloid: longer path, time 0.566 s — 17% faster dips 0.601 m — below B — and still wins steep start buys speed early — average speed beats extra distance

Finally, keep one interpretive habit: read the variational derivative δJ/δy(x)\delta J/\delta y(x) as a "force per unit path-displacement at the point xx" — for a hanging chain it is literally the net force on the bit of chain at xx, and it vanishes on the true configuration. An infinite-dimensional gradient still has a clean component-by-component meaning.

From points to paths

A functional eats a whole function and returns one number — the length of a curve, the time of a descent, the action of a trajectory. The workhorse form integrates a smooth function of the path, its slope, and the independent variable:

J[y]=∫x1x2f(y(x),y′(x),x) dx(1)J[y]=\int_{x_1}^{x_2} f\big(y(x),y'(x),x\big)\,\mathrm{d}x \qquad (1)

where: J[y]J[y] — a functional: a real number assigned to the entire function yy; ff — the integrand, a given smooth function of three arguments; y(x)y(x) — the candidate path; y′(x)y'(x) — its derivative; x1,x2x_1,x_2 — fixed endpoints. The square brackets are a standing reminder that JJ depends on the shape of the whole curve: change yy anywhere and JJ generally changes. To probe stationarity we need a controlled way to deform a candidate — the classic trick embeds yy in a one-parameter family of nearby paths, all sharing its endpoints:

yϵ(x)=y(x)+ϵ η(x),η(x1)=η(x2)=0(2)y_\epsilon(x)=y(x)+\epsilon\,\eta(x),\qquad \eta(x_1)=\eta(x_2)=0 \qquad (2)

where: ϵ\epsilon — a small real number labeling how far along the deformation we have slid; η(x)\eta(x) — an arbitrary smooth test function, the shape of the wiggle, pinned to zero at both ends. The arbitrariness of η\eta is what will make the final condition pointwise. With the family in hand, J[yϵ]J[y_\epsilon] is an ordinary function of the single number ϵ\epsilon. Stationarity becomes the most familiar statement in calculus — a vanishing derivative:

δJ=ddϵJ[yϵ]∣ϵ=0=0(3)\delta J=\left.\frac{\mathrm{d}}{\mathrm{d}\epsilon}J[y_\epsilon]\right|_{\epsilon=0}=0 \qquad (3)

where: δJ\delta J — the first variation, the part of J[y+ϵη]−J[y]J[y+\epsilon\eta]-J[y] linear in ϵ\epsilon. It must vanish for every admissible η\eta; that universal quantifier is what produces a differential equation rather than a single scalar condition.

Step 1. Freeze the wiggle, vary the knob. For fixed yy and η\eta, define g(ϵ)≡J[y+ϵη]g(\epsilon)\equiv J[y+\epsilon\eta] — a plain function of one real variable. Why: this reduction is the entire strategy — every theorem of one-variable calculus now applies.

Step 2. Demand a stationary point at the origin. If yy makes JJ stationary, then ϵ=0\epsilon=0 is a stationary point of gg for every η\eta: the first variation δJ≡g′(0)\delta J\equiv g'(0) must vanish for all admissible η\eta. Why: one condition per test function, infinitely many test functions — enough to determine the function yy itself.

Derivation AThe Euler–Lagrange equation

The target is equation (5), the Euler–Lagrange equation — the pointwise differential condition equivalent to the global statement δJ=0\delta J=0 for the workhorse functional (1). The route: compute the first variation by differentiating under the integral sign, then confront its one structural obstruction — the variation's slope η′\eta' appears alongside η\eta itself, so nothing can yet be factored out. Integration by parts is the move that clears it, shifting the derivative off the arbitrary wiggle onto the known integrand, and the fundamental lemma then converts "one vanishing integral for every η\eta" into "one equation at every point". Two places demand care: the boundary term dies only because admissible variations are pinned to zero at both endpoints (a free endpoint replaces it by a natural boundary condition), and the final pointwise step is a theorem — the fundamental lemma — not a shrug, which is why it gets its own derivation next. Differentiating g(ϵ)g(\epsilon) under the integral sign, the chain rule on f(y+ϵη, y′+ϵη′, x)f(y+\epsilon\eta,\,y'+\epsilon\eta',\,x) gives the first variation in raw form — the wiggle and its slope both appear:

δJ=∫x1x2(∂f∂y η+∂f∂y′ η′)dx(4)\delta J=\int_{x_1}^{x_2}\left(\frac{\partial f}{\partial y}\,\eta+\frac{\partial f}{\partial y'}\,\eta'\right)\mathrm{d}x \qquad (4)

where: ∂f/∂y\partial f/\partial y, ∂f/∂y′\partial f/\partial y' — partial derivatives of the integrand with the other slots held fixed; η′\eta' — the slope of the variation. The awkward guest is the η′\eta' term: the slope of a wiggle is not independent of the wiggle, so as it stands we cannot factor η\eta out and conclude anything pointwise.

Step 1. Integrate the awkward term by parts.

∫x1x2∂f∂y′η′ dx=[∂f∂y′η]x1x2−∫x1x2ddx ⁣(∂f∂y′)η dx\int_{x_1}^{x_2}\frac{\partial f}{\partial y'}\eta'\,\mathrm{d}x=\left[\frac{\partial f}{\partial y'}\eta\right]_{x_1}^{x_2}-\int_{x_1}^{x_2}\frac{\mathrm{d}}{\mathrm{d}x}\!\left(\frac{\partial f}{\partial y'}\right)\eta\,\mathrm{d}x

Why: this shifts the derivative off the arbitrary η\eta onto the known ∂f/∂y′\partial f/\partial y', at the price of a boundary term — morally inevitable, because only a bare factor of η\eta lets us exploit its arbitrariness.

Step 2. Kill the boundary term.

[∂f∂y′η]x1x2=0\left[\frac{\partial f}{\partial y'}\eta\right]_{x_1}^{x_2}=0

Why: η(x1)=η(x2)=0\eta(x_1)=\eta(x_2)=0 by construction — every admissible wiggle vanishes at the fixed endpoints. (A free endpoint would instead demand the natural boundary condition ∂f/∂y′=0\partial f/\partial y'=0 there.)

Step 3. Collect a single integral against η\eta.

δJ=∫x1x2[∂f∂y−ddx∂f∂y′]η dx=0\delta J=\int_{x_1}^{x_2}\left[\frac{\partial f}{\partial y}-\frac{\mathrm{d}}{\mathrm{d}x}\frac{\partial f}{\partial y'}\right]\eta\,\mathrm{d}x=0

Why: the arbitrary function now multiplies one definite expression M(x)M(x) — the setup the fundamental lemma demands.

Step 4. Invoke the fundamental lemma. The integral vanishes for all admissible η\eta, so the bracket must vanish identically. Why: if it were nonzero anywhere, a bump-shaped η\eta parked there would make the integral nonzero — contradiction.

∂f∂y−ddx ⁣(∂f∂y′)=0(5)\frac{\partial f}{\partial y}-\frac{\mathrm{d}}{\mathrm{d}x}\!\left(\frac{\partial f}{\partial y'}\right)=0 \qquad (5)

where: d/dx\mathrm{d}/\mathrm{d}x — the total derivative along the path. Read it as a balance law: the direct sensitivity of ff to the path's value must offset the rate of change of its sensitivity to the slope. With x→tx\to t, f→Lf\to L this is the equation of motion of mechanics; for f=1+y′2f=\sqrt{1+y'^2} it says straight lines; for Fermat's optical path it is Snell's law run continuously.

Figure
The fundamental lemma — a bump test function parked where M is nonzero
x₁ x₂ c M(x) > 0 near c — the supposed offender bump η(x) ≥ 0, supported only where M > 0 product M·η > 0 on the bump, 0 elsewhere ⇒ integral cannot vanish — contradiction
Go deeper · Derivation B · 1 minThe fundamental lemma
Derivation BThe fundamental lemma

The claim to prove is the logical engine of the whole subject: if a continuous M(x)M(x) satisfies ∫x1x2M(x)η(x) dx=0\int_{x_1}^{x_2}M(x)\eta(x)\,\mathrm{d}x=0 for every smooth η\eta vanishing at the endpoints, then M(x)≡0M(x)\equiv 0 — this lemma is the hinge on which Step 4 of the previous derivation turned an integral statement about the whole path into a differential equation at each point. The proof is a contradiction with the picture above behind it: suppose MM fails to vanish somewhere, and park a bump-shaped test function exactly there. Watch the role of continuity — it is what guarantees the supposed offender stays positive over a whole window, giving the bump room to live; drop it and the argument fails. Watch also the legality of the bump itself: it must be smooth, non-negative, and vanish at the endpoints, or it is not an admissible test function and proves nothing.

Step 1. Suppose not. Assume MM is continuous and M(c)≠0M(c)\neq 0 at some interior point c∈(x1,x2)c\in(x_1,x_2); without loss of generality take M(c)>0M(c)>0. Why: we will show any nonzero value anywhere is fatal.

Step 2. Continuity buys a neighborhood. There is an interval (c−ρ, c+ρ)⊂(x1,x2)(c-\rho,\,c+\rho)\subset(x_1,x_2) on which M(x)>0M(x)>0. Why: a continuous function positive at a point stays positive in a whole window around it.

Step 3. Choose a bump supported in that window.

η(x)={[(x−c+ρ)(c+ρ−x)]2∣x−c∣<ρ0otherwise\eta(x)=\begin{cases}\big[(x-c+\rho)(c+\rho-x)\big]^2 & |x-c|<\rho\\ 0 & \text{otherwise}\end{cases}

Why: this η\eta is smooth (C1C^1 at least, C∞C^\infty with a mollifier bump), vanishes at the endpoints, is non-negative, and is strictly positive exactly where MM is — a legal test function engineered to expose the offender.

Step 4. The integral cannot vanish.

∫x1x2M(x)η(x) dx=∫c−ρc+ρM(x)⏟>0η(x)⏟>0 dx>0\int_{x_1}^{x_2}M(x)\eta(x)\,\mathrm{d}x=\int_{c-\rho}^{c+\rho}\underbrace{M(x)}_{>0}\underbrace{\eta(x)}_{>0}\,\mathrm{d}x>0

Why: the integrand is strictly positive over a set of positive measure — contradicting the hypothesis.

Step 5. Conclude. The assumption M(c)≠0M(c)\neq0 is impossible, hence M(x)=0M(x)=0 everywhere. Why this matters: this is the exact point where an integral statement about the whole path becomes a differential equation at each point — the hinge of the entire subject.

The variational derivative

The Euler–Lagrange bracket deserves a name of its own, because it is the infinite-dimensional gradient. In ordinary calculus ∂f/∂xi\partial f/\partial x_i answers "how fast does ff change per unit change of coordinate ii?" Here the coordinates are the values of yy at each point:

δJδy(x)=∂f∂y−ddx∂f∂y′(6)\frac{\delta J}{\delta y(x)}=\frac{\partial f}{\partial y}-\frac{\mathrm{d}}{\mathrm{d}x}\frac{\partial f}{\partial y'} \qquad (6)

where: δJ/δy(x)\delta J/\delta y(x) — the functional (variational) derivative: the rate of change of JJ per unit change of the path at the single point xx. Stationarity is exactly δJ/δy(x)=0\delta J/\delta y(x)=0 at every xx — the perfect analogue of ∇f=0\nabla f = 0. Once the gradient exists, the chain rule follows — the sum over coordinates becoming an integral over points:

δJ=∫x1x2δJδy(x) δy(x) dx(7)\delta J=\int_{x_1}^{x_2}\frac{\delta J}{\delta y(x)}\,\delta y(x)\,\mathrm{d}x \qquad (7)

where: δy(x)\delta y(x) — the direction of the variation at the point xx, that is the η(x)\eta(x) of equation (2), so that (7) returns exactly the first variation δJ\delta J defined in (3). (Write δy=ϵ η\delta y=\epsilon\,\eta instead and the left-hand side becomes the O(ϵ)O(\epsilon) change ϵ δJ\epsilon\,\delta J, not δJ\delta J itself — the two conventions differ by that factor and must not be mixed.) This is the continuum version of df=∑i(∂f/∂xi) dxi\mathrm{d}f=\sum_i(\partial f/\partial x_i)\,\mathrm{d}x_i: each point contributes its gradient component times its displacement. The dictionary between discrete and continuum closes with one identity. In nn dimensions the coordinates are mutually independent, ∂xi/∂xj=δij\partial x_i/\partial x_j = \delta_{ij}; in path space the values of yy at distinct points are independent in the distributional sense:

δy(x)δy(x′)=δ(x−x′)(8)\frac{\delta y(x)}{\delta y(x')}=\delta(x-x') \qquad (8)

where: δ(x−x′)\delta(x-x') — the Dirac delta, the continuum limit of the Kronecker δij\delta_{ij}. This one line is the passport to field theory: replace y(x)y(x) by a field ϕ(xμ)\phi(x^\mu) and every manipulation of this article carries over verbatim.

Go deeper · Derivation C · 1 minSeveral dependent variables
Derivation CSeveral dependent variables

Mechanics almost never has one coordinate, so the single-variable result must be promoted to nn functions at once: for the functional J[q1,…,qn]=∫x1x2f(q1,…,qn,q1′,…,qn′,x) dxJ[q_1,\dots,q_n]=\int_{x_1}^{x_2}f(q_1,\dots,q_n,q_1',\dots,q_n',x)\,\mathrm{d}x we will show that stationarity demands one Euler–Lagrange equation per coordinate — the full system of equations of motion of analytical mechanics. The strategy is to rerun Derivation 1 wholesale: give every path its own independent wiggle ηi\eta_i, integrate by parts term by term, and then exploit the independence by switching on one ηj\eta_j at a time. That independence is the entire crux, and the place to be careful: nothing in the variation couples the coordinates — the only coupling lives inside ff itself — which is exactly why the nn conditions decouple cleanly rather than arriving as one entangled constraint.

Step 1. Vary every path independently. Set qi→qi+ϵ ηi(x)q_i \to q_i+\epsilon\,\eta_i(x) with independent test functions ηi\eta_i all vanishing at the endpoints. Why: the coordinates are independent degrees of freedom; nothing couples their wiggles except ff itself.

Step 2. Expand and integrate by parts term-by-term.

δJ=∫x1x2∑i=1n(∂f∂qi−ddx∂f∂qi′)ηi dx\delta J=\int_{x_1}^{x_2}\sum_{i=1}^{n}\left(\frac{\partial f}{\partial q_i}-\frac{\mathrm{d}}{\mathrm{d}x}\frac{\partial f}{\partial q_i'}\right)\eta_i\,\mathrm{d}x

Why: each ηi′\eta_i' is traded for ηi\eta_i exactly as in Derivation 1 — every boundary term dies separately, since every ηi\eta_i vanishes at both endpoints.

Step 3. Isolate one coordinate at a time. Choose ηj≠0\eta_j\neq0 for a single index jj and all other ηi=0\eta_i=0; the fundamental lemma forces the jj-th bracket to vanish. Repeating for each jj:

∂f∂qi−ddx∂f∂qi′=0,i=1,…,n\frac{\partial f}{\partial q_i}-\frac{\mathrm{d}}{\mathrm{d}x}\frac{\partial f}{\partial q_i'}=0,\qquad i=1,\dots,n

Why: independence of the variations decouples the conditions — one Euler–Lagrange equation per generalized coordinate: the full system of equations of motion of analytical mechanics.

Go deeper · Derivation D · 1 minThe Beltrami identity
Derivation DThe Beltrami identity

Second-order equations are expensive; symmetries pay the bill, and the goal here is to cash the first cheque: whenever the integrand carries no explicit xx-dependence, the combination f−y′ ∂f/∂y′f-y'\,\partial f/\partial y' is constant along every extremal — the Beltrami identity, equation (9), which drops the Euler–Lagrange equation from second order to first and is what makes the brachistochrone solvable in closed form. The route is direct construction: differentiate ff totally along the path, differentiate the candidate combination, and subtract so that the unwieldy y′′y'' terms cancel by design; the Euler–Lagrange equation then kills what remains. Two cautions. The identity holds only on solutions — it uses the EL equation in the final step, so it is a property of extremals, not of arbitrary curves; and with x→tx\to t, f→Lf\to L the conserved combination is minus the energy function, so a sign slip here silently flips the physics:

f−y′∂f∂y′=const(if ∂f/∂x=0)(9)f - y'\frac{\partial f}{\partial y'}=\text{const}\quad(\text{if }\partial f/\partial x=0) \qquad (9)

where: the constant is a first integral — a quantity frozen along the extremal. With x→tx\to t and f→Lf\to L this combination is minus the energy function (the Jacobi integral): time-translation symmetry conserving energy, met before Noether's theorem names the pattern.

Step 1. Differentiate ff totally along the path.

dfdx=∂f∂yy′+∂f∂y′y′′+∂f∂x\frac{\mathrm{d}f}{\mathrm{d}x}=\frac{\partial f}{\partial y}y'+\frac{\partial f}{\partial y'}y''+\frac{\partial f}{\partial x}

Why: chain rule on f(y,y′,x)f(y,y',x) — along the extremal both yy and y′y' change with xx.

Step 2. Differentiate the candidate combination's second term.

ddx ⁣(y′∂f∂y′)=y′′∂f∂y′+y′ddx∂f∂y′\frac{\mathrm{d}}{\mathrm{d}x}\!\left(y'\frac{\partial f}{\partial y'}\right)=y''\frac{\partial f}{\partial y'}+y'\frac{\mathrm{d}}{\mathrm{d}x}\frac{\partial f}{\partial y'}

Why: product rule; we are engineering a subtraction in which the unwieldy y′′y'' terms cancel.

Step 3. Subtract and watch the cancellation.

ddx ⁣(f−y′∂f∂y′)=∂f∂yy′−y′ddx∂f∂y′+∂f∂x\frac{\mathrm{d}}{\mathrm{d}x}\!\left(f-y'\frac{\partial f}{\partial y'}\right)=\frac{\partial f}{\partial y}y'-y'\frac{\mathrm{d}}{\mathrm{d}x}\frac{\partial f}{\partial y'}+\frac{\partial f}{\partial x}

Why: the y′′ ∂f/∂y′y''\,\partial f/\partial y' terms cancel exactly — the combination was chosen precisely to make them.

Step 4. Invoke Euler–Lagrange. On an extremal the bracket multiplying y′y' vanishes, leaving ddx(f−y′∂f/∂y′)=∂f/∂x\frac{\mathrm{d}}{\mathrm{d}x}(f-y'\partial f/\partial y')=\partial f/\partial x. Why: the identity holds only on solutions — a property of extremals, not of arbitrary curves.

Step 5. Apply x-independence. If ∂f/∂x=0\partial f/\partial x=0 the right side vanishes and f−y′ ∂f/∂y′f-y'\,\partial f/\partial y' is constant — equation (9). Why this matters: a second-order ODE drops to first order, which is what makes the brachistochrone solvable in closed form below.

Limiting cases

CaseResultMeaning
ff independent of yy∂f∂y′=const\frac{\partial f}{\partial y'}=\text{const}EL integrates immediately: the conjugate "momentum" is conserved — the origin of cyclic coordinates.
ff independent of xxf−y′∂f∂y′=constf - y'\frac{\partial f}{\partial y'}=\text{const}Beltrami: with x→tx\to t, energy conservation; order drops by one.
ff independent of y′y'∂f∂y=0\frac{\partial f}{\partial y}=0Nothing to integrate by parts: purely algebraic, fixing y(x)y(x) pointwise.
Free endpoint∂f∂y′=0\frac{\partial f}{\partial y'}=0 at that endThe boundary term must vanish on its own: a natural boundary condition.
Several functions yi(x)y_i(x)one EL equation per yiy_iIndependent variations decouple the conditions; coupling survives only inside ff.
Higher derivatives in ff∂f∂y−ddx∂f∂y′+d2dx2∂f∂y′′=0\frac{\partial f}{\partial y}-\frac{\mathrm{d}}{\mathrm{d}x}\frac{\partial f}{\partial y'}+\frac{\mathrm{d}^2}{\mathrm{d}x^2}\frac{\partial f}{\partial y''}=0Euler–Poisson equation (stiff beams): higher order, more boundary conditions.

Worked examples

1 · Shortest path between two points — earning a fact you already know (confidence builder)

Show that the shortest curve from (0,0)(0,0) to (3,4)(3,4) (metres) is the straight line, compute its length, and check numerically that a detour is longer.

Step 1. Write the functional. Arc length is J[y]=∫031+y′2 dxJ[y]=\int_0^3 \sqrt{1+y'^2}\,\mathrm{d}x, so f=1+y′2f=\sqrt{1+y'^2} — no explicit yy or xx.

Step 2. Exploit the missing yy. Since ∂f/∂y=0\partial f/\partial y=0, the EL equation collapses to y′1+y′2=const\dfrac{y'}{\sqrt{1+y'^2}}=\text{const}.

Step 3. Solve. A constant value forces y′=consty'=\text{const}: the extremals are straight lines. The endpoints give y=43xy=\tfrac{4}{3}x.

Step 4. Compute the length: J=∫031+16/9 dx=3⋅53=5 mJ=\int_0^3\sqrt{1+16/9}\,\mathrm{d}x=3\cdot\tfrac{5}{3}=\boxed{5\ \mathrm{m}} — the 3-4-5 triangle.

Step 5. Stress-test with a detour. Take y=43x+a x(3−x)y=\tfrac{4}{3}x+a\,x(3-x), which still hits both endpoints: numerically, length 5.00985.0098 m for a=0.1a=0.1 and 5.30625.3062 m for a=0.5a=0.5 — always longer, and quintupling the deformation multiplied the excess by about thirty, not five: the first-order change vanishes on the extremal, so the excess grows at second order.

2 · The brachistochrone, with numbers (exam level)

A bead slides from rest at the origin, without friction, to a point 1.001.00 m across and 0.600.60 m down (g=9.81 m s−2g=9.81\ \mathrm{m\,s^{-2}}; yy measured downward). Find the fastest wire, its descent time, and compare with the straight ramp.

Step 1. Build the time functional. Energy conservation gives v=2gyv=\sqrt{2gy}, so T[y]=∫0x21+y′22gy dxT[y]=\displaystyle\int_0^{x_2}\sqrt{\frac{1+y'^2}{2gy}}\,\mathrm{d}x — no explicit xx: Beltrami applies.

Step 2. Apply the Beltrami identity (9). With f=(1+y′2)/2gyf=\sqrt{(1+y'^2)/2gy}, algebra reduces f−y′ ∂f/∂y′f-y'\,\partial f/\partial y' to [2gy(1+y′2)]−1/2=const\big[2gy(1+y'^2)\big]^{-1/2}=\text{const}, i.e. y (1+y′2)=2Ry\,(1+y'^2)=2R.

Step 3. Recognize the cycloid. The first-order ODE is solved parametrically by x=R(θ−sin⁡θ)x=R(\theta-\sin\theta), y=R(1−cos⁡θ)y=R(1-\cos\theta) — a point on a rolling wheel of radius RR, launching with a vertical tangent (the wire dives straight down at the start).

Step 4. Fit the endpoint. The target requires y2x2=1−cos⁡θfθf−sin⁡θf=0.60\dfrac{y_2}{x_2}=\dfrac{1-\cos\theta_f}{\theta_f-\sin\theta_f}=0.60. Solving numerically: θf=3.234 rad\theta_f=3.234\ \mathrm{rad} (185.3∘185.3^\circ), then R=y2/(1−cos⁡θf)=0.3006 mR=y_2/(1-\cos\theta_f)=\boxed{0.3006\ \mathrm{m}}. Since θf>π\theta_f>\pi, the wire dips to depth 2R=0.6012R=0.601 m — below its destination — and comes back up.

Step 5. Compute the descent time. Along the cycloid ds=2Rsin⁡(θ/2) dθ\mathrm{d}s=2R\sin(\theta/2)\,\mathrm{d}\theta and v=2gR sin⁡(θ/2)v=2\sqrt{gR}\,\sin(\theta/2), so dt=R/g dθ\mathrm{d}t=\sqrt{R/g}\,\mathrm{d}\theta — time flows uniformly in θ\theta. Hence T=θfR/g=0.566 sT=\theta_f\sqrt{R/g}=\boxed{0.566\ \mathrm{s}}.

Step 6. Race the straight ramp. The chord has length d=1.002+0.602=1.166d=\sqrt{1.00^2+0.60^2}=1.166 m and constant acceleration g y2/dg\,y_2/d along it, so Tline=2d2/(gy2)=0.680 sT_{\text{line}}=\sqrt{2d^2/(g y_2)}=\boxed{0.680\ \mathrm{s}}. The cycloid wins by 0.1140.114 s — 16.7% faster despite being the longer path: average speed beats distance.

Origins · 1 minLeonhard Euler and how this was discovered
LE
Leonhard Euler
1707–1783 · St Petersburg and Berlin

Euler turned the scattered endpoint problems of the Bernoulli generation into a subject. His 1744 treatise Methodus Inveniendi derived what we now call the Euler–Lagrange equation by approximating curves with polygons, then solved dozens of problems with it — including the elastica, whose appendix reads today like the first chapter of field theory. When the nineteen-year-old Lagrange wrote to him in 1755 with a purely analytic derivation built on the δ\delta symbol, Euler did something rare in the history of priority: he adopted the young man's method, held back his own related work, and coined the name calculus of variations in Lagrange's honor. Blind for his last seventeen years, he produced nearly half his output in that darkness — computing, as one eulogy put it, as men breathe.

History
1696
— Johann Bernoulli poses the brachistochrone challenge; Newton, Leibniz, l'Hôpital, and both Bernoullis solve it — the cycloid.
1744
— Euler's Methodus Inveniendi, the first systematic treatise, derives the Euler–Lagrange equation by polygonal approximation.
1755
— The 19-year-old Lagrange sends Euler his analytic δ-method; Euler adopts it and names the subject the "calculus of variations."
1788
— Lagrange's Mécanique analytique rebuilds mechanics on variational foundations — famously, without a single diagram.
1915
— Hilbert derives Einstein's field equations from a stationary-action principle; Noether's theorem follows three years later.

Going further

References. Morin, Introduction to Classical Mechanics, Ch. 6 · Goldstein, Poole & Safko, Classical Mechanics 3rd ed., Ch. 2 · Landau & Lifshitz, Mechanics 3rd ed., §2 · Taylor, Classical Mechanics, Ch. 6 · Gelfand & Fomin, Calculus of Variations · Lanczos, Variational Principles of Mechanics, Ch. 2 The worked-example numbers were computed numerically: shortest-path lengths 5 / 5.0098 / 5.3062 m; brachistochrone parameters θf=3.234\theta_f=3.234 rad, R=0.3006R=0.3006 m, descent time T=0.566T=0.566 s versus the straight ramp's 0.680 s. The functional-derivative identity δy(x)/δy(x′)=δ(x−x′)\delta y(x)/\delta y(x')=\delta(x-x') is standard. The brachistochrone solution (cycloid) and the geodesic-on-sphere (great circle) are analytically exact results.

Builds on: The Action Functional · The Lagrangian Function · Generalized Coordinates and Configuration Space Leads to: The Euler-Lagrange Equations · Hamilton's Principle of Stationary Action · Cyclic Coordinates and Conservation of Conjugate Momenta · The Energy Function and Jacobi Integral

What is the actual difference between δy\delta y and dy\mathrm{d}y?

They compare different things. The differential dy\mathrm{d}y moves you along one fixed curve: advance xx by dx\mathrm{d}x and record how far yy climbs. The variation δy=ϵ η(x)\delta y=\epsilon\,\eta(x) freezes xx entirely and jumps between two different curves at that same point — it reshapes the function, not the position along it. That is why δJ\delta J compares the scores of rival paths while df\mathrm{d}f never leaves a single one. The two operations even commute, δ(y′)=(δy)′\delta(y')=(\delta y)', precisely because they act on independent slots: one on the shape of the curve, the other on the running variable. Conflate them and the whole derivation of equation (4) stops making sense — the wiggle η\eta would be tied to the slope of the path itself.

How can yy and y′y' be independent slots in ff when y′y' is literally the derivative of yy?

Because ff is just a smooth function of three arguments — call them slots — and ∂f/∂y\partial f/\partial y, ∂f/∂y′\partial f/\partial y' mean nothing more than "vary one slot, hold the others". The relationship y′=dy/dxy'=\mathrm{d}y/\mathrm{d}x is imposed afterwards, when you evaluate ff along an actual path and when the total derivative d/dx\mathrm{d}/\mathrm{d}x acts in the Euler–Lagrange equation (5) — that total derivative is exactly the step that re-links the slots. You can see the two roles separated in the first variation (4): deforming the path changes the value slot through η\eta and the slope slot through η′\eta', and the two contributions enter with different coefficients. If yy and y′y' were not treated as independent arguments there, those two terms could never be told apart.

Why is δ\delta allowed to pass through the integral sign?

Because δJ\delta J is defined as an ordinary ϵ\epsilon-derivative: equation (3) says δJ=dJ[y+ϵη]/dϵ\delta J=\mathrm{d}J[y+\epsilon\eta]/\mathrm{d}\epsilon at ϵ=0\epsilon=0. Once the wiggle shape η\eta is frozen, g(ϵ)=J[yϵ]g(\epsilon)=J[y_\epsilon] is a plain function of one real variable, and pushing its derivative through the integral is the Leibniz rule for differentiation under the integral sign — legitimate here because ff is smooth in its slots, η\eta is smooth, and crucially the limits x1,x2x_1,x_2 do not depend on ϵ\epsilon. Nothing mystical about δ\delta survives this reading; it is the ordinary chain rule producing equation (4). Had the endpoints themselves moved with ϵ\epsilon, Leibniz's rule would add endpoint terms — a genuine complication that variable-endpoint problems must handle explicitly.

Why must η\eta vanish at the endpoints — and what if my endpoint really is free?

The requirement is not decoration; it is what kills the boundary term [(∂f/∂y′) η]x1x2\big[(\partial f/\partial y')\,\eta\big]_{x_1}^{x_2} generated by the integration by parts. Physically it encodes the problem statement: we are ranking curves that all connect the same A to the same B, so admissible competitors may not move the pins. Drop the requirement and the boundary term survives, contaminating δJ\delta J with endpoint contributions that no interior equation can cancel. If your endpoint genuinely is free — a sliding attachment, an unspecified arrival ordinate — the variation there is arbitrary, and stationarity then demands the boundary term vanish on its own: ∂f/∂y′=0\partial f/\partial y'=0 at that end, the natural boundary condition. So a free endpoint does not weaken the theory; it trades one pinned value for one extra equation.

If I have solved δJ=0\delta J=0, have I actually found a minimum?

Not yet — you have found a stationary path, and maxima and saddles satisfy δJ=0\delta J=0 just as happily. First-order information cannot tell them apart; that is the second variation's job, exactly as the second derivative test follows the first in ordinary calculus. The stakes are real in mechanics: a true trajectory minimizes the action only over sufficiently short intervals, and beyond a conjugate point it becomes a saddle — "least action" is a historical misnomer for stationary action. The shortest-path worked example shows what a genuine minimum looks like: the detour y=43x+a x(3−x)y=\tfrac43x+a\,x(3-x) exceeded length 5 m by an amount growing like a2a^2 (quintupling aa multiplied the excess by about thirty), the quadratic signature of a positive second variation.

How does one vanishing integral turn into an equation at every single point?

Because it is not one condition — it is one condition per test function, and there are infinitely many. δJ=0\delta J=0 must hold for every admissible η\eta, so Step 3 of the derivation hands you a whole family of statements ∫M(x) η(x) dx=0\int M(x)\,\eta(x)\,\mathrm{d}x=0, one for each wiggle shape. The fundamental lemma is the theorem that cashes this in: if a continuous MM integrates to zero against every endpoint-vanishing η\eta, then M≡0M\equiv0. The proof is the bump picture — were M(c)≠0M(c)\neq0, continuity keeps it one-signed on a window (c−ρ,c+ρ)(c-\rho,c+\rho), and a non-negative bump parked exactly there makes the integral strictly positive, a contradiction. Continuity is load-bearing: it is what buys the window the bump lives in. Without it the pointwise conclusion genuinely fails.

The Beltrami identity looks like pure algebra — why does it hold only on extremals?

Follow the derivation to Step 4: after the engineered cancellation of the y′′y'' terms, what remains is ddx(f−y′ ∂f/∂y′)=y′(∂f/∂y−ddx∂f/∂y′)+∂f/∂x\frac{\mathrm{d}}{\mathrm{d}x}\big(f-y'\,\partial f/\partial y'\big)=y'\big(\partial f/\partial y-\frac{\mathrm{d}}{\mathrm{d}x}\partial f/\partial y'\big)+\partial f/\partial x, and the bracket multiplying y′y' is precisely the Euler–Lagrange expression. It vanishes only on solutions. Feed in an arbitrary curve with ∂f/∂x=0\partial f/\partial x=0 and the combination f−y′ ∂f/∂y′f-y'\,\partial f/\partial y' drifts freely. This is the same logical status as energy conservation in mechanics — which, with x→tx\to t and f→Lf\to L, it literally is (minus the Jacobi integral): energy is conserved along actual motions, not along any kinematically imaginable path. First integrals are rewards for solving the equations, not identities of the integrand.

How can the cycloid dip below its destination and still be the fastest path?

Because the score is time, not length, and time weights each element of arc by 1/v1/v with v=2gyv=\sqrt{2gy} depending only on depth. In the worked example the endpoint slope forces θf=3.234>π\theta_f=3.234>\pi, so the optimal wire plunges to 2R=0.6012R=0.601 m — below B — before climbing back. The dip is an investment: the extra descent makes the bead fast precisely through the long middle stretch where most of the distance is covered, and along a cycloid the descent is so efficiently organized that time flows uniformly in the rolling angle, dt=R/g dθ\mathrm{d}t=\sqrt{R/g}\,\mathrm{d}\theta. The climb back to B costs less time than the borrowed speed saved. Net result: 0.5660.566 s against the straight ramp's 0.6800.680 s — the longer, deeper path wins by 17%.

Before this

Where this leads