The Euler-Lagrange equation

In this article, I’ll prove the Euler-Lagrange equation and give some examples of applications. I’ll use some other theorems without proof: Fermat’s theorem, the fundamental lemma of the calculus of variations, the multivariate chain rule, and integrations by parts.

Theorem: Consider the functional II defined by
I(f)=abL(f,f,x) dx I(f) = \int_a^b L(f, f', x)\ \text{d}x

If ff is a differentiable function for which this functional has a local extremum, then it must satisfy the Euler-Lagrange equation:
Lf=ddxLf \frac{\partial L}{\partial f} = \frac{\text{d}}{\text{d}x} \frac{\partial L}{\partial f'}

Proof: Define a mapping hh that maps a real number to a function as
h(α)=f+αη h(\alpha) = f + \alpha \eta
where η\eta is any differentiable function with η(a)=η(b)=0\eta(a) = \eta(b) = 0. Suppose that ff is a differential function for which II has a local extremum. Then, by Fermat’s theorem, we have that ddαI(h(α))α=0=0\frac{\text{d} }{\text{d} \alpha} I(h(\alpha)) |_{\alpha = 0} = 0 when ff is a local extremum of II.

Working out ddαI(h(α))\frac{\text{d} }{\text{d} \alpha} I(h(\alpha)) gives
ddαI(h(α))=ddαabL(h,h,x) dx=abddαL(h,h,x) dx \frac{\text{d}}{\text{d} \alpha} I(h(\alpha)) = \frac{\text{d}}{\text{d} \alpha} \int_a^b L(h, h', x)\ \text{d}x = \int_a^b \frac{\text{d}}{\text{d} \alpha} L(h, h', x)\ \text{d}x

Technically, I have to show that switching the order of integration and differentiation is allowed, but I’ll omit this step for now.

Using the multivariate chain rule, we see this last expression equals abLhdhdα+Lhdhdα dx\int_a^b \frac{\partial L}{\partial h} \frac{\text{d} h}{\text{d} \alpha} + \frac{\partial L}{\partial h'} \frac{\text{d} h'}{\text{d} \alpha}\ \text{d}x, so we have
ddαI(h(α))=abLhdhdα+Lhdhdα dx \frac{\text{d}}{\text{d} \alpha} I(h(\alpha)) = \int_a^b \frac{\partial L}{\partial h} \frac{\text{d} h}{\text{d} \alpha} + \frac{\partial L}{\partial h'} \frac{\text{d} h'}{\text{d} \alpha}\ \text{d}x

Note that the term Lxdxdα\frac{\partial L}{\partial x} \frac{\text{d} x}{\text{d} \alpha} does not occur since dxdα=0\frac{\text{d} x}{\text{d} \alpha} = 0. Now we use that dhdα=η\frac{\text{d} h}{\text{d} \alpha} = \eta and dhdα=η\frac{\text{d} h'}{\text{d} \alpha} = \eta', and obtain

ddαI(h(α))=abLhη(x)+Lhη(x) dx \frac{\text{d}}{\text{d} \alpha} I(h(\alpha)) = \int_a^b \frac{\partial L}{\partial h} \eta(x) + \frac{\partial L}{\partial h'} \eta'(x)\ \text{d}x

Now, consider the integral over only the second term. By using integration by parts, we see
abLhη(x) dx=Lhη(b)Lhη(a)abddxLhη(x) dx \int_a^b \frac{\partial L}{\partial h'} \eta'(x)\ \text{d}x = \frac{\partial L}{\partial h'} \eta(b) - \frac{\partial L}{\partial h'} \eta(a) - \int_a^b \frac{\text{d}}{\text{d}x}\frac{\partial L}{\partial h'} \eta(x)\ \text{d}x

Using that η(a)=η(b)=0\eta(a) = \eta(b) = 0, this simplifies to just
abLhη(x) dx=abddxLhη(x) dx \int_a^b \frac{\partial L}{\partial h'} \eta'(x)\ \text{d}x = -\int_a^b \frac{\text{d}}{\text{d}x}\frac{\partial L}{\partial h'} \eta(x)\ \text{d}x

Substituting this back in the equation for ddαI(h(α))\frac{\text{d}}{\text{d} \alpha} I(h(\alpha)) yields
ddαI(h(α))=ab(LhddxLh)η(x) dx \frac{\text{d}}{\text{d} \alpha} I(h(\alpha)) = \int_a^b \left( \frac{\partial L}{\partial h} - \frac{\text{d}}{\text{d}x}\frac{\partial L}{\partial h'} \right) \eta(x)\ \text{d}x

We have h(0)=fh(0) = f, so evaluating the whole thing at α=0\alpha = 0, we get
ddαI(h(α))=ab(LfddxLf)η(x) dx \frac{\text{d}}{\text{d} \alpha} I(h(\alpha)) = \int_a^b \left( \frac{\partial L}{\partial f} - \frac{\text{d}}{\text{d}x}\frac{\partial L}{\partial f'} \right) \eta(x)\ \text{d}x

Remembering that ddαI(h(α))=0\frac{\text{d}}{\text{d} \alpha} I(h(\alpha)) = 0 by Fermat’s theorem, we have
ab(LfddxLf)η(x) dx=0 \int_a^b \left( \frac{\partial L}{\partial f} - \frac{\text{d}}{\text{d}x}\frac{\partial L}{\partial f'} \right) \eta(x)\ \text{d}x = 0

for any differentiable η\eta with η(a)=η(b)=0\eta(a) = \eta(b) = 0. By the fundamental lemma of the calculus of variations, it follows that LfddxLf=0\frac{\partial L}{\partial f} - \frac{\text{d}}{\text{d}x}\frac{\partial L}{\partial f'} = 0, which yields
Lf=ddxLf\frac{\partial L}{\partial f} = \frac{\text{d}}{\text{d}x}\frac{\partial L}{\partial f'}

when rearranged. \square

If the integrand L(f,f,x)L(f, f', x) does not depend on ff or on xx, the Euler-Lagrange equation can be simplified. Let’s first consider the case where the integrand does not depend on ff:

Corollary: Consider the functional II defined by
I(f)=abL(f,x) dx I(f) = \int_a^b L(f', x)\ \text{d}x

If ff is a differentiable function for which this functional has a local extremum, then
Lf \frac{\partial L}{\partial f'}

is constant.

Proof: Note that this is a special case of the Euler-Lagrange equation where we have Lf=0\frac{\partial L}{\partial f} = 0. Substituting this in the Euler-Lagrange equation, we get ddxLf=0\frac{\text{d}}{\text{d}x} \frac{\partial L}{\partial f'} = 0. It follows that Lf\frac{\partial L}{\partial f'} is constant. \square

The case where LL does not depend on xx is similar, but less straightforward to prove.

Corollary: Consider the functional
I(f)=abL(f,f) dx I(f) = \int_a^b L(f', f)\ \text{d}x

If ff is a differentiable function for which this functional has a local extremum, then
LffL \frac{\partial L}{\partial f'} f' - L

is constant.

Proof: By the multivariate chain rule, we have
dLdx=Lfdfdx+Lfdfdx \frac{\text{d}L}{\text{d}x} = \frac{\partial L}{\partial f} \frac{\text{d}f}{\text{d}x} + \frac{\partial L}{\partial f'} \frac{\text{d}f'}{\text{d}x}

Substituting the Euler-Lagrange equation Lf=ddxLf\frac{\partial L}{\partial f} = \frac{\text{d}}{\text{d}x} \frac{\partial L}{\partial f'} in this expression yields
dLdx=(ddxLf)dfdx+Lfdfdx \frac{\text{d}L}{\text{d}x} = \left(\frac{\text{d}}{\text{d}x} \frac{\partial L}{\partial f'} \right) \frac{\text{d}f}{\text{d}x} + \frac{\partial L}{\partial f'} \frac{\text{d}f'}{\text{d}x}

Writing ff' for dfdx\frac{\text{d}f}{\text{d}x}, we can use the product rule:
(ddxLf)f+Lf(ddxf)=ddx(Lff) \left(\frac{\text{d}}{\text{d}x} \frac{\partial L}{\partial f'} \right) f' + \frac{\partial L}{\partial f'} \left( \frac{\text{d}}{\text{d}x} f' \right) = \frac{\text{d}}{\text{d}x}( \frac{\partial L}{\partial f'} f')

Substituting this, we obtain
dLdx=ddx(Lff) \frac{\text{d}L}{\text{d}x} = \frac{\text{d}}{\text{d}x}( \frac{\partial L}{\partial f'} f')

After subtracting dLdx\frac{\text{d}L}{\text{d}x} from both sides we have
ddx(LfL)=0 \frac{\text{d}}{\text{d}x} \left( \frac{\partial L}{\partial f'} - L \right) = 0

This implies that
LfL \frac{\partial L}{\partial f'} - L

is constant. \square

Examples

The Euler-Lagrange equation is a helpful tool, but it usually requires some work to arrive at a solution. Here, I show some well-known applications of the Euler-Lagrange equation.

The shortest path between two points is a straight line

This intuitively obvious statement is not trivial to prove. I’ll give a proof using the Euler-Lagrange equation. I’ll take as a given that the length of a curve y(x)y(x) from x=ax=a to x=bx=b is given by
ab1+(dydx)2 dx \int_a^b \sqrt{1 + \left( \frac{\text{d} y}{\text{d} x} \right)^2}\ \text{d} x

An intuitive idea for why this holds can be obtained by considering that the length of a linear line segment is Δx2+Δy2\sqrt{\Delta x^2 + \Delta y^2}, where Δx\Delta x and Δy\Delta y are the differences in the x-coordinate and y-coordinate. Letting Δx0\Delta x \rightarrow 0, we get dx2+dy2\sqrt{\text{d} x^2 + \text{d} y^2}, and integrating yields the expression
abdx2+dy2=ab1+(dydx)2 dx \int_a^b \sqrt{\text{d} x^2 + \text{d} y^2} = \int_a^b \sqrt{1 + \left( \frac{\text{d} y}{\text{d} x} \right)^2}\ \text{d} x

for the length of the differentiable curve yy from (a,y(a)(a, y(a) to (b,y(b))(b, y(b)).

Setting I(f)=ab1+(dydx)2 dxI(f) = \int_a^b \sqrt{1 + \left( \frac{\text{d} y}{\text{d} x} \right)^2}\ \text{d} x, the Euler-Lagrange equation now gives
ddxy1+(y)2=0 \frac{\text{d}}{\text{d}x} \frac{\partial}{\partial y} \sqrt{1 + (y')^2} = 0

Working out the derivatives gives
ddxy1+(y)2=ddxy1+(y)2=y1+(y)23=0 \frac{\text{d}}{\text{d}x} \frac{\partial}{\partial y} \sqrt{1 + (y')^2} = \frac{\text{d}}{\text{d}x} \frac{y'}{\sqrt{1 + (y')^2}} = \frac{y''}{\sqrt{1 + (y')^2}^3} = 0

Since the denominator is always positive, it follows that y=0y'' = 0, and yy must be of the form
y(x)=ax+b y(x) = ax + b

Brachistochrone

A brachistochrone curve through two points AA and BB on a plane is defined as the curve that minimizes the time that it takes from a point to slide from AA to BB from a standstill, neglecting friction. Of course, this assumes that the height of BB is less than the height of AA.

Tackling this problem requires some physics. The potential energy, which is the energy that the particle gets from its height is mghmgh, where mm is the mass of the particle, gg is some gravitational constant, and hh is the height of the particle. The kinetic energy, that the particle gets from its speed, is 12mv2\frac{1}{2} mv^2. Since we pretend there’s no friction and ignore other types of energy, the sum of these two energies is constant by the law of conservation of energy. If we assume that the mass of the particle mm is constant as well, we find
12v2+gh=c \frac{1}{2} v^2 + gh = c

for some constant cc.

Re-arranging, we find v=2gdhv = \sqrt{2g} \sqrt{d - h} with d=bgd = \frac{b}{g}. Since gg is a constant, the speed depends only on the height hh of the ball, which is an interesting result in itself. It is particularly convenient to assume that the height AA is zero, so that y=dhy = d - h. Note that the yy axis points downwards in this case. In this case, we obtain:
v=2gyv = \sqrt{2gy}

Now, as we used before, the length of an infinitesimal curve segment is 1+(y)2 dx\sqrt{1 + (y')^2}\ \text{d}x. The speed at yy is 2gy\sqrt{2gy}. The time that is takes a ball to roll over the line segment is simply the length of the segment divided by its speed. So we can express the time it takes to roll from AA to BB as
xAxB1+(y)22gy dx \int_{x_A}^{x_B} \sqrt{ \frac{1 + (y')^2}{2gy}}\ \text{d}x

With this we finally have the integral to minimize, and we can use the Euler-Lagrange equation with L=1+(y)22gyL = \sqrt{ \frac{1 + (y')^2}{2gy}}. In fact, the integrand does not depend on xx, so we can use a simplified version. From this, we gather that
LyyL=C \frac{\partial L}{\partial y'} y' - L = C

for some constant CC. Now, first, compute Ly\frac{\partial L}{\partial y'}:
Ly=12gyy1+(y)2\frac{\partial L}{\partial y'} = \frac{1}{\sqrt{2gy}} \frac{y'}{\sqrt{1 + (y')^2}}

Substituting this in the previous equation yields

12gy((y)21+(y)21+(y)2)=C \frac{1}{\sqrt{2gy}} \left( \frac{(y')^2}{\sqrt{1 + (y')^2}} - \sqrt{ 1 + (y')^2} \right) = C

Simplifying gives
12gy11+(y)2=C \frac{1}{\sqrt{2gy}} \frac{-1}{\sqrt{1 + (y')^2}} = C

y(1+(y)2)=12gC \sqrt{y (1 + (y')^2)} = -\frac{1}{\sqrt{2g}C}

y(1+(y)2)=r2 y (1 + (y')^2) = r^2

with r=12gCr = \frac{1}{\sqrt{2g}C}. Now, write y=dydxy' = \frac{\text{d}y}{\text{d}x}. We can then rewrite to
y(dx2+dy2)=r2dx2 y(\text{d}x^2 + \text{d}y^2) = r^2 \text{d}x^2

Now, we want to write xx and yy as a function of a parameter tt. Divide both sides by dt2\text{d}t^2 to get
y((dxdt)2+(dydt)2)=r2(dxdt)2 y\left(\left(\frac{\text{d}x}{\text{d}t}\right)^2 + \left(\frac{\text{d}y}{\text{d}t}\right)^2 \right) = r^2 \left( \frac{\text{d}x}{\text{d}t} \right)^2

Then it can be checked that
x(t)=r22(tsin(t)) x(t) = \frac{r^2}{2}(t - \sin(t))

y(t)=r22(1cos(t)) y(t) = \frac{r^2}{2}(1 - \cos(t))

is a solution to this differential equation.