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
-
\dfrac{\partial L}{\partial y} - \dfrac{d}{dx}\dfrac{\partial L}{\partial y'} = 0;
-
it is a necessary condition for a stationary curve — the continuous
analogue of "derivative equals zero";
-
the boundary term drops out precisely because the endpoints are held fixed
(\eta(a) = \eta(b) = 0).
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.
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 \eta — is the Euler–Lagrange
condition.