4.10.13 · D2Advanced Topics (Elite Level)

Visual walkthrough — Euler-Lagrange equation — derivation

2,131 words10 min readBack to topic

Related trails: Calculus of Variations · Principle of Least Action · Lagrangian Mechanics · Integration by Parts · Beltrami Identity.


Step 1 — What is a functional, really?

WHAT. In ordinary calculus you feed a number into a function and get a number out. A functional is one level up: you feed an entire curve in, and get a single number out.

  • is the slope of the curve — how steeply it rises at .
  • , the Lagrangian, is a scoring machine: at each point it looks at where you are, how high you are, and how steep you are, and spits out a little cost.
  • adds up all those little costs along the curve into one total.

WHY this step. Before we can hunt for the best curve, we must be crystal clear that the thing we are minimizing is one number attached to a whole curve. Change the curve → change the number.

PICTURE. The left panel is the "number in, number out" world of . The right panel is the new world: a red curve goes in, a single number comes out.

Figure — Euler-Lagrange equation — derivation

Step 2 — Fix the endpoints, then build nearby rivals

WHAT. Suppose the winning curve is (drawn in red). We compare it against a whole family of competitors, all pinned to the same two endpoints and :

  • (Greek "eta") is an arbitrary smooth wiggle — any bump you like.
  • (Greek "epsilon") is a dial controlling how big the wiggle is. At we are exactly on the champion.

WHY this step. Ordinary calculus can't "differentiate over all curves" directly. So we sneak an ordinary number, , into the problem: it turns "wiggle the whole curve" into "turn one knob".

Endpoint rule. Every rival must hit the same start and finish. Since the champion already sits there, the wiggle must vanish at the ends: Otherwise the rival would fly through the wrong endpoint — disqualified.

PICTURE. Red champion curve, several faint black rivals fanning around it, all clamped at the two endpoints where the wiggle is pinched to zero.

Figure — Euler-Lagrange equation — derivation

Step 3 — Collapse the curve-search into a single-number graph

WHAT. Feed the whole family into the functional. The result depends only on the dial :

Now is an ordinary function of one number. Because the champion (at ) is the best, moving the dial either way can only make things worse (or flat). So is a stationary point:

  • is the ordinary slope of this one-variable graph.
  • Setting it to zero is the exact same idea as " at a minimum" — just applied to .

WHY this step. This is the whole trick: an infinite-dimensional problem (all curves) has been squeezed into a 1-D problem (one parabola-like graph in ). We already know how to find the bottom of such a graph.

PICTURE. A U-shaped curve with its flat bottom marked in red at — the tangent there is horizontal.

Figure — Euler-Lagrange equation — derivation

Step 4 — Differentiate under the integral (chain rule)

WHAT. Take inside the integral. First, a notation reminder so nothing is ambiguous:

  • is the perturbed curve — a rival that depends on the dial .
  • is the champion, the special rival at .
  • means "differentiate the scoring machine with respect to its height slot, then evaluate that slot at ". Likewise is the derivative in its slope slot, evaluated at .

feels only through and its slope , so the chain rule gives two channels:

Now evaluate at . There and , so the height slot is filled by and the slope slot by — that is exactly what turns every uppercase into a lowercase :

Because , bumping raises the height by and the slope by . Putting it together:

WHY this step. We turned "the graph is flat" into a concrete integral condition tying together the wiggle , its slope , and the scoring machine's sensitivities — all read off along the champion curve .

PICTURE. Two "sensitivity channels": one arrow from the height wiggle into , one from the slope wiggle into .

Figure — Euler-Lagrange equation — derivation

Step 5 — Integration by parts: free from its derivative

WHAT. The term with is annoying — it has a derivative of the wiggle, not the wiggle itself. The tool that swaps a derivative from one factor onto another is Integration by Parts. Its identity is:

Here we make the choice that removes the derivative from :

  • let , so ;
  • let , so (integrating just gives back ).

Feeding those into the identity:

  • The boundary term is evaluated only at the endpoints and .
  • By Step 2, , so this whole boundary term is zero. This is precisely why we pinned the endpoints.

WHY this step. We want a single, bare multiplying everything, so we can later argue " is arbitrary". The blocked that; integration by parts (choosing so the derivative lands on instead) removes it at the small price of a boundary term — which our endpoint rule kills.

PICTURE. The boundary term drawn as two dots at and ; a red "= 0" stamp over them because is pinched there.

Figure — Euler-Lagrange equation — derivation

Step 6 — Factor out the wiggle

WHAT. Put the pieces back together. Both surviving terms now carry a bare , so factor it:

  • is a fixed function determined by the champion curve — it does not depend on the wiggle.
  • is any smooth wiggle vanishing at the ends.

WHY this step. We have isolated the situation "some fixed function , dotted against every possible wiggle , always gives zero." That is a very strong statement — Step 7 cashes it in.

PICTURE. A single black landscape with a red wiggle laid over it; the shaded product must integrate to exactly zero for every red wiggle.

Figure — Euler-Lagrange equation — derivation

Step 7 — The Fundamental Lemma forces

WHAT. If for every admissible , then everywhere on .

WHY it must be true (the steel-man). Suppose were, say, positive on some little interval. Then choose a wiggle that is a small positive bump sitting exactly over that interval and zero elsewhere. The product is positive there and zero elsewhere, so the integral is strictly positive — contradicting "it's always zero". The only escape is .

PICTURE. A patch where (black), and a red bump planted right on it; the shaded positive area proves the integral can't be zero unless vanishes.

Figure — Euler-Lagrange equation — derivation

Setting gives the result:


Step 8 — Edge case: what if the endpoints are free?

WHAT. In Step 5 we killed the boundary term using . But suppose an endpoint is not pinned — the curve may end anywhere on a vertical line, so need not vanish there. Then that piece of the boundary term survives, and (since the interior already forces the E–L equation) it must vanish on its own. Three sub-cases:

(a) Only the right end is free ( but arbitrary):

(b) Only the left end is free ( but arbitrary):

(c) Both ends free ( and both arbitrary and independent): you get two natural boundary conditions at once,

(d) Endpoints constrained to lie on given curves/manifolds (not fixed points, not fully free — e.g. the end must sit on a target curve): the surviving boundary term produces a transversality condition, a relation mixing and that says the extremal must meet the target curve at a prescribed angle. This is the general umbrella that (a)–(c) are special cases of.

WHY this step matters. You must always check what the endpoints are allowed to do. Fixed points → boundary term dies, plain E–L. Free ends → E–L plus one natural condition per free end. Ends on a manifold → E–L plus a transversality condition. Forgetting the surviving boundary term is a classic trap.

PICTURE. Left: both ends pinned (wiggle vanishes → boundary term dies). Right: right end free to slide on a vertical rail (red), so a new condition appears there.

Figure — Euler-Lagrange equation — derivation

The one-picture summary

Everything above, compressed into a single flow: curve → number → dial → flat graph → integral condition → E–L ODE.

Figure — Euler-Lagrange equation — derivation

Functional J of a curve y

Perturb y plus eps eta with pinned ends

Phi of eps a one number graph

Flat at eps = 0 so dPhi deps = 0

Chain rule gives integral of dL dy eta plus dL dy' eta prime

Integration by parts frees eta boundary term dies

Integral of g times eta = 0 for all eta

Fundamental Lemma forces g = 0

Euler Lagrange equation

Recall Feynman retelling — say it in plain words

We wanted the best curve, not the best number. Trick: score every curve with one number . Take the curve we suspect is best, and nudge it with a tiny adjustable wiggle , keeping its two ends nailed down. Now the score depends on just one dial , so it's an ordinary graph — and if our curve is truly best, that graph is flat at . Writing "flat" as a derivative gives an integral mixing the wiggle and its slope . We don't want the slope of the wiggle lying around, so we integrate by parts to trade it away; the leftover boundary term dies because we pinned the ends. Now the whole integral is "(some fixed function ) times (any wiggle) ". Since the wiggle can be any bump, the fixed function must be zero everywhere — otherwise plant a bump where it isn't zero and break the equation. That "" is the Euler–Lagrange equation. If an end is left free instead of pinned, the boundary term survives and hands you a bonus condition there; if both ends are free you get two such conditions, and if an end must ride along a target curve you get a transversality condition instead.

Recall Quick self-test

Why must for fixed endpoints? ::: Every rival curve must pass through the same two endpoints as the champion, so the wiggle cannot move those points. Which step needs the endpoint condition? ::: Step 5 — it makes the boundary term from integration by parts vanish. In integration by parts, which choice of and removes the derivative from ? ::: and , so comes out derivative-free. What does the Fundamental Lemma let us conclude from ? ::: That everywhere, because is arbitrary. If both endpoints are free, what extra conditions appear? ::: Two natural boundary conditions, at each end.