The Euler–Lagrange Equation

We want the curve y(x) that makes a functional

J[y] = \int_a^b L(x, y, y')\,dx

stationary, over all curves running between the same two fixed endpoints y(a) and y(b). The trick is the same one that powers Lagrange multipliers: at a stationary point, a tiny nudge in any allowed direction must change the value nothing to first order. Here the "directions" are nudges to the whole curve.

The derivation, step by step

Step 1 — perturb the curve. Suppose y is the winner. Build a one-parameter family around it by adding a small bump \eta(x) scaled by \varepsilon. To keep the endpoints pinned, the bump must vanish there:

y_\varepsilon(x) = y(x) + \varepsilon\,\eta(x), \qquad \eta(a) = \eta(b) = 0.

Step 2 — reduce to ordinary calculus. Feed the family into the functional. The result is now an ordinary function of the single number \varepsilon:

g(\varepsilon) = J[y + \varepsilon\eta] = \int_a^b L\big(x,\ y + \varepsilon\eta,\ y' + \varepsilon\eta'\big)\,dx.

Because y is stationary, \varepsilon = 0 must be a critical point of g, so g'(0) = 0.

Step 3 — differentiate under the integral. Apply the chain rule to L; the x-slot doesn't move with \varepsilon, but the y and y' slots do. Setting \varepsilon = 0:

g'(0) = \int_a^b \left( \frac{\partial L}{\partial y}\,\eta + \frac{\partial L}{\partial y'}\,\eta' \right) dx = 0.

Step 4 — integrate the second term by parts. The \eta' is awkward — we want a clean factor of \eta throughout. Integration by parts moves the derivative off \eta:

\int_a^b \frac{\partial L}{\partial y'}\,\eta'\,dx = \left[ \frac{\partial L}{\partial y'}\,\eta \right]_a^b - \int_a^b \frac{d}{dx}\!\left( \frac{\partial L}{\partial y'} \right)\eta\,dx.

Step 5 — kill the boundary term. The endpoints are pinned, so \eta(a) = \eta(b) = 0 and the bracket \left[ L_{y'}\,\eta \right]_a^b vanishes outright. Substitute back and collect the common factor \eta:

\int_a^b \left( \frac{\partial L}{\partial y} - \frac{d}{dx}\frac{\partial L}{\partial y'} \right)\eta\,dx = 0.

Step 6 — invoke the fundamental lemma. This must hold for every allowed bump \eta. The fundamental lemma of the calculus of variations says that if a continuous function integrated against every such \eta always gives zero, the function itself must be zero everywhere. Hence the bracket vanishes pointwise:

\frac{\partial L}{\partial y} - \frac{d}{dx}\frac{\partial L}{\partial y'} = 0. A curve y(x) with fixed endpoints makes J[y] = \int_a^b L(x, y, y')\,dx stationary only if it satisfies the second-order differential equation

It is tempting to treat a curve satisfying the Euler–Lagrange equation as automatically "the answer" — the winning shape. Resist that. Go back to how ordinary calculus works: f'(x_0) = 0 tells you x_0 is a critical point, but it could be a minimum, a maximum, or a mere inflection — you need a second-derivative test, or other reasoning, to tell which.

The Euler–Lagrange equation plays exactly the same limited role, one level up. A curve y(x) that satisfies it — an extremal — is only guaranteed to make the functional stationary: the first-order change vanishes. It might be a genuine minimum (as for arc length), a maximum, or a saddle-like critical path where nearby curves both raise and lower the value. The equation is a necessary condition, not a sufficient one — solving it is the first step, not the last. Confirming which kind of extremal you've found needs further work (a second-variation test, or a shortcut like the Beltrami identity for Lagrangians with no explicit x-dependence), exactly as a lone f'(x_0)=0 needs a follow-up check in ordinary calculus.

Push the Euler–Lagrange equation onto the brachistochrone functional — the travel time for a bead sliding under gravity — and grind through the algebra (it takes a genuinely clever substitution, more than the arc-length example here) and out drops a shockingly specific answer: the fastest curve is a cycloid, the very curve traced by a single point on the rim of a wheel as the wheel rolls along a straight line.

Nobody in 1696 was expecting that. It isn't a circular arc, and it definitely isn't the straight line most people guess first. It's a shape more familiar from a bicycle reflector bobbing up and down as the wheel turns. That a wheel-rolling curve should also be the answer to "what's the fastest slide?" is one of those results that feels like it must be a coincidence — until you see the two problems really are governed by the same equation. Solving the brachistochrone this way is what convinced 17th-century mathematicians that this new method — stationary functionals, not stationary numbers — was a genuinely new and powerful branch of mathematics, worth building an entire field around.

A worked check: the shortest path is straight

Take arc length, L = \sqrt{1 + y'^2}. It has no bare y in it, so the first term is easy.

The y-derivative is zero, since L contains no y:

\frac{\partial L}{\partial y} = 0.

The y'-derivative uses the chain rule on the square root:

\frac{\partial L}{\partial y'} = \frac{y'}{\sqrt{1 + y'^2}}.

Euler–Lagrange then forces that quantity to be constant in x:

0 - \frac{d}{dx}\!\left( \frac{y'}{\sqrt{1 + y'^2}} \right) = 0 \;\Longrightarrow\; \frac{y'}{\sqrt{1 + y'^2}} = \text{const}.

A constant slope-fraction means y' is itself constant, so y'' = 0 and

y = mx + c.

The extremal of arc length is a straight line — the equation rediscovers what we knew, which is exactly the reassurance a new tool should give before we turn it on a problem we can't guess.

A second worked example: recovering the oscillator equation

Physics leans on the calculus of variations constantly, and this next Lagrangian is the one behind a spring: L = \tfrac12 y'^2 - \tfrac12 k^2 y^2, where y plays the role of position and k is a fixed constant. Unlike arc length, this L depends on y itself, so both terms of the equation now do real work.

The y-derivative picks up the y-dependent term:

\frac{\partial L}{\partial y} = -k^2 y.

The y'-derivative picks up the other term, and then needs one more derivative with respect to x:

\frac{\partial L}{\partial y'} = y' \qquad\Longrightarrow\qquad \frac{d}{dx}\frac{\partial L}{\partial y'} = y''.

Euler–Lagrange combines them into a single, very recognisable, differential equation:

-k^2 y - y'' = 0 \;\Longrightarrow\; y'' + k^2 y = 0.

That's the equation for simple harmonic motion, solved by y = A\sin(kx + \varphi) for constants A and \varphi fixed by the endpoints. The same machine that rediscovered "the shortest path is a straight line" from geometry has, with a different Lagrangian plugged in, rediscovered the equation of a swinging spring from mechanics. That's the real power on display here: one equation, L_y - \tfrac{d}{dx}L_{y'} = 0, quietly generates the governing law for whatever physical (or purely geometric) quantity L happens to encode.

See stationarity at ε = 0

The extremal here is the straight line y = 0 joining (0,0) to (2,0). The slider adds the bump \varepsilon\,\eta(x) with \eta = \sin(\pi x / 2) — zero at both ends, as required. Watch the arc-length functional J[y + \varepsilon\eta]: it bottoms out exactly at \varepsilon = 0 and is flat there. That flatness — no first-order change in any direction \etais the Euler–Lagrange condition.