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 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.
- A functional assigns a number to an entire function — ; the calculus of variations finds the functions that make stationary.
- Perturb the path by with vanishing at the endpoints; stationarity means for every admissible wiggle .
- Integration by parts plus the fundamental lemma turn that integral condition into a pointwise one: the Euler–Lagrange equation.
- The variational derivative 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: free of conserves ; free of conserves (Beltrami — energy conservation in disguise).
- Key idea: Stationarity of a functional under fixed-endpoint variations forces, via integration by parts and the fundamental lemma, the pointwise Euler–Lagrange equation — 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 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 measuring how far fluctuations stray. A proposal for new physics is an integrand — 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 for the weights and biases and steps along , not along a functional derivative . 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 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 you can add at each point. A path is stationary when wiggling it in any allowed way produces no first-order change in .
Read the figure as a contest: every curve from A to B is a legal competitor, and 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 . 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:
Finally, keep one interpretive habit: read the variational derivative as a "force per unit path-displacement at the point " — for a hanging chain it is literally the net force on the bit of chain at , 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:
where: — a functional: a real number assigned to the entire function ; — the integrand, a given smooth function of three arguments; — the candidate path; — its derivative; — fixed endpoints. The square brackets are a standing reminder that depends on the shape of the whole curve: change anywhere and generally changes. To probe stationarity we need a controlled way to deform a candidate — the classic trick embeds in a one-parameter family of nearby paths, all sharing its endpoints:
where: — a small real number labeling how far along the deformation we have slid; — an arbitrary smooth test function, the shape of the wiggle, pinned to zero at both ends. The arbitrariness of is what will make the final condition pointwise. With the family in hand, is an ordinary function of the single number . Stationarity becomes the most familiar statement in calculus — a vanishing derivative:
where: — the first variation, the part of linear in . It must vanish for every admissible ; 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 and , define — 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 makes stationary, then is a stationary point of for every : the first variation must vanish for all admissible . Why: one condition per test function, infinitely many test functions — enough to determine the function itself.
The target is equation (5), the Euler–Lagrange equation — the pointwise differential condition equivalent to the global statement 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 appears alongside 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 " 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 under the integral sign, the chain rule on gives the first variation in raw form — the wiggle and its slope both appear:
where: , — partial derivatives of the integrand with the other slots held fixed; — the slope of the variation. The awkward guest is the term: the slope of a wiggle is not independent of the wiggle, so as it stands we cannot factor out and conclude anything pointwise.
Step 1. Integrate the awkward term by parts.
Why: this shifts the derivative off the arbitrary onto the known , at the price of a boundary term — morally inevitable, because only a bare factor of lets us exploit its arbitrariness.
Step 2. Kill the boundary term.
Why: by construction — every admissible wiggle vanishes at the fixed endpoints. (A free endpoint would instead demand the natural boundary condition there.)
Step 3. Collect a single integral against .
Why: the arbitrary function now multiplies one definite expression — the setup the fundamental lemma demands.
Step 4. Invoke the fundamental lemma. The integral vanishes for all admissible , so the bracket must vanish identically. Why: if it were nonzero anywhere, a bump-shaped parked there would make the integral nonzero — contradiction.
where: — the total derivative along the path. Read it as a balance law: the direct sensitivity of to the path's value must offset the rate of change of its sensitivity to the slope. With , this is the equation of motion of mechanics; for it says straight lines; for Fermat's optical path it is Snell's law run continuously.
Go deeper · Derivation B · 1 minThe fundamental lemma
The claim to prove is the logical engine of the whole subject: if a continuous satisfies for every smooth vanishing at the endpoints, then — 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 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 is continuous and at some interior point ; without loss of generality take . Why: we will show any nonzero value anywhere is fatal.
Step 2. Continuity buys a neighborhood. There is an interval on which . 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.
Why: this is smooth ( at least, with a mollifier bump), vanishes at the endpoints, is non-negative, and is strictly positive exactly where is — a legal test function engineered to expose the offender.
Step 4. The integral cannot vanish.
Why: the integrand is strictly positive over a set of positive measure — contradicting the hypothesis.
Step 5. Conclude. The assumption is impossible, hence 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 answers "how fast does change per unit change of coordinate ?" Here the coordinates are the values of at each point:
where: — the functional (variational) derivative: the rate of change of per unit change of the path at the single point . Stationarity is exactly at every — the perfect analogue of . Once the gradient exists, the chain rule follows — the sum over coordinates becoming an integral over points:
where: — the direction of the variation at the point , that is the of equation (2), so that (7) returns exactly the first variation defined in (3). (Write instead and the left-hand side becomes the change , not itself — the two conventions differ by that factor and must not be mixed.) This is the continuum version of : each point contributes its gradient component times its displacement. The dictionary between discrete and continuum closes with one identity. In dimensions the coordinates are mutually independent, ; in path space the values of at distinct points are independent in the distributional sense:
where: — the Dirac delta, the continuum limit of the Kronecker . This one line is the passport to field theory: replace by a field and every manipulation of this article carries over verbatim.
Go deeper · Derivation C · 1 minSeveral dependent variables
Mechanics almost never has one coordinate, so the single-variable result must be promoted to functions at once: for the functional 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 , integrate by parts term by term, and then exploit the independence by switching on one 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 itself — which is exactly why the conditions decouple cleanly rather than arriving as one entangled constraint.
Step 1. Vary every path independently. Set with independent test functions all vanishing at the endpoints. Why: the coordinates are independent degrees of freedom; nothing couples their wiggles except itself.
Step 2. Expand and integrate by parts term-by-term.
Why: each is traded for exactly as in Derivation 1 — every boundary term dies separately, since every vanishes at both endpoints.
Step 3. Isolate one coordinate at a time. Choose for a single index and all other ; the fundamental lemma forces the -th bracket to vanish. Repeating for each :
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
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 -dependence, the combination 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 totally along the path, differentiate the candidate combination, and subtract so that the unwieldy 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 , the conserved combination is minus the energy function, so a sign slip here silently flips the physics:
where: the constant is a first integral — a quantity frozen along the extremal. With and 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 totally along the path.
Why: chain rule on — along the extremal both and change with .
Step 2. Differentiate the candidate combination's second term.
Why: product rule; we are engineering a subtraction in which the unwieldy terms cancel.
Step 3. Subtract and watch the cancellation.
Why: the terms cancel exactly — the combination was chosen precisely to make them.
Step 4. Invoke Euler–Lagrange. On an extremal the bracket multiplying vanishes, leaving . Why: the identity holds only on solutions — a property of extremals, not of arbitrary curves.
Step 5. Apply x-independence. If the right side vanishes and 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
| Case | Result | Meaning |
|---|---|---|
| independent of | EL integrates immediately: the conjugate "momentum" is conserved — the origin of cyclic coordinates. | |
| independent of | Beltrami: with , energy conservation; order drops by one. | |
| independent of | Nothing to integrate by parts: purely algebraic, fixing pointwise. | |
| Free endpoint | at that end | The boundary term must vanish on its own: a natural boundary condition. |
| Several functions | one EL equation per | Independent variations decouple the conditions; coupling survives only inside . |
| Higher derivatives in | Euler–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 to (metres) is the straight line, compute its length, and check numerically that a detour is longer.
Step 1. Write the functional. Arc length is , so — no explicit or .
Step 2. Exploit the missing . Since , the EL equation collapses to .
Step 3. Solve. A constant value forces : the extremals are straight lines. The endpoints give .
Step 4. Compute the length: — the 3-4-5 triangle.
Step 5. Stress-test with a detour. Take , which still hits both endpoints: numerically, length m for and m for — 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 m across and m down (; measured downward). Find the fastest wire, its descent time, and compare with the straight ramp.
Step 1. Build the time functional. Energy conservation gives , so — no explicit : Beltrami applies.
Step 2. Apply the Beltrami identity (9). With , algebra reduces to , i.e. .
Step 3. Recognize the cycloid. The first-order ODE is solved parametrically by , — a point on a rolling wheel of radius , launching with a vertical tangent (the wire dives straight down at the start).
Step 4. Fit the endpoint. The target requires . Solving numerically: (), then . Since , the wire dips to depth m — below its destination — and comes back up.
Step 5. Compute the descent time. Along the cycloid and , so — time flows uniformly in . Hence .
Step 6. Race the straight ramp. The chord has length m and constant acceleration along it, so . The cycloid wins by s — 16.7% faster despite being the longer path: average speed beats distance.
Origins · 1 minLeonhard Euler and how this was discovered
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 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.
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 rad, m, descent time s versus the straight ramp's 0.680 s. The functional-derivative identity 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 and ?
They compare different things. The differential moves you along one fixed curve: advance by and record how far climbs. The variation freezes entirely and jumps between two different curves at that same point — it reshapes the function, not the position along it. That is why compares the scores of rival paths while never leaves a single one. The two operations even commute, , 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 would be tied to the slope of the path itself.
How can and be independent slots in when is literally the derivative of ?
Because is just a smooth function of three arguments — call them slots — and , mean nothing more than "vary one slot, hold the others". The relationship is imposed afterwards, when you evaluate along an actual path and when the total derivative 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 and the slope slot through , and the two contributions enter with different coefficients. If and were not treated as independent arguments there, those two terms could never be told apart.
Why is allowed to pass through the integral sign?
Because is defined as an ordinary -derivative: equation (3) says at . Once the wiggle shape is frozen, 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 is smooth in its slots, is smooth, and crucially the limits do not depend on . Nothing mystical about survives this reading; it is the ordinary chain rule producing equation (4). Had the endpoints themselves moved with , Leibniz's rule would add endpoint terms — a genuine complication that variable-endpoint problems must handle explicitly.
Why must vanish at the endpoints — and what if my endpoint really is free?
The requirement is not decoration; it is what kills the boundary term 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 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: 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 , have I actually found a minimum?
Not yet — you have found a stationary path, and maxima and saddles satisfy 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 exceeded length 5 m by an amount growing like (quintupling 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. must hold for every admissible , so Step 3 of the derivation hands you a whole family of statements , one for each wiggle shape. The fundamental lemma is the theorem that cashes this in: if a continuous integrates to zero against every endpoint-vanishing , then . The proof is the bump picture — were , continuity keeps it one-signed on a window , 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 terms, what remains is , and the bracket multiplying is precisely the Euler–Lagrange expression. It vanishes only on solutions. Feed in an arbitrary curve with and the combination drifts freely. This is the same logical status as energy conservation in mechanics — which, with and , 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 with depending only on depth. In the worked example the endpoint slope forces , so the optimal wire plunges to 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, . The climb back to B costs less time than the borrowed speed saved. Net result: s against the straight ramp's s — the longer, deeper path wins by 17%.