4 Worked Exercises
The three worked problems progress from fundamental to computational and advanced. In each case, start by identifying admissible variations, perform integration by parts only after computing the first variation, and separate interior equations from boundary terms.
4.1 Exercise 1 — Fundamental
Find stationary point of the functional
\mathcal{F}(x) = \int_0^2 \left( x(t)^2 + x(t)(x'(t))^2 + t x(t) \right) \, \mathrm{d}t
with constraint
x(0)=0,\qquad x(2) = 1
First Variation
We start by applying the first variation to the functional: \mathcal{F}(x). To compute the variation, we first take the variation of the integrand:
\begin{aligned} \delta\mathcal{F}(x) & = \delta \int_0^2 \left( x(t)^2 + x(t)(x'(t))^2 + t x(t) \right) \, \mathrm{d}t \\ & = \int_0^2 \delta \left( x(t)^2 + x(t)(x'(t))^2 + t x(t) \right) \, \mathrm{d}t \\ & = \int_0^2 \left( 2x(t) \delta x(t) + \delta x(t) (x'(t))^2 + 2x(t) x'(t) \delta x'(t) + t \delta x(t) \right) \, \mathrm{d}t \\ & = \int_0^2 \left( \left( 2x(t) + (x'(t))^2 + t \right) \delta x(t) + \textcolor{blue}{2x(t)x'(t) \delta x'(t)} \right) \, \mathrm{d}t \end{aligned}
Here, we expanded the variation term by term and grouped the expressions. The blue term \textcolor{blue}{2x(t)x'(t) \delta x'(t)} is crucial for the integration by parts.
Integration by Parts
To eliminate the \delta x'(t) term, we apply integration by parts to the expression \textcolor{blue}{2x(t)x'(t) \delta x'(t)}:
\begin{aligned} \frac{\mathrm{d}}{\mathrm{d}t} \left( 2x(t) x'(t) \delta x(t) \right) & = \textcolor{blue}{2x(t) x'(t) \delta x'(t)} + \frac{\mathrm{d}}{\mathrm{d}t} \left( 2x(t) x'(t) \right) \delta x(t) \\ & = \textcolor{blue}{2x(t) x'(t) \delta x'(t)} + 2 \left( (x'(t))^2 + x(t)x''(t) \right) \delta x(t) \end{aligned}
This allows us to rewrite the variation of \mathcal{F}(x) as:
\begin{aligned} \delta\mathcal{F}(x) & = \int_0^2 \left( 2x(t) + (x'(t))^2 + t \right) \delta x(t) + \textcolor{blue}{2x(t)x'(t) \delta x'(t)} \, \mathrm{d}t \\ & = \int_0^2 \left( 2x(t) + (x'(t))^2 + t \right) \delta x(t) \, \mathrm{d}t \\ & \quad + \textcolor{red}{\left[ \frac{\mathrm{d}}{\mathrm{d}t} \left( 2x(t)x'(t)\delta x(t) \right) - 2 \left( (x'(t))^2 + x(t) x''(t) \right) \delta x(t) \right]} \, \mathrm{d}t \end{aligned}
Now, after applying the integration by parts, we can group terms again:
\begin{aligned} \delta\mathcal{F}(x) & = \int_0^2 \left( 2x(t) - (x'(t))^2 + t - 2x(t) x''(t) \right) \delta x(t) \, \mathrm{d}t \\ & \quad + \Big[ 2x(t)x'(t)\delta x(t) \Big]_0^2 \end{aligned}
Since \delta x(0) = \delta x(2) = 0 (from the boundary conditions), the boundary term vanishes. Therefore, we are left with:
\delta\mathcal{F}(x) = \int_0^2 \left( 2x(t) - (x'(t))^2 + t - 2x(t)x''(t) \right) \delta x(t) \, \mathrm{d}t
Euler–Lagrange Equation
For the variation \delta\mathcal{F}(x) to be zero for all variations \delta x(t), the integrand must vanish. Therefore, we obtain the Euler-Lagrange equation:
2x(t) - (x'(t))^2 + t - 2x(t)x''(t) = 0
Boundary Conditions
The problem also specifies boundary conditions:
x(0) = 0, \quad x(2) = 1
Final Problem
Thus, the full problem is to solve the following boundary value problem:
\left\{ \begin{aligned} & 2x(t) - (x'(t))^2 + t - 2x(t)x''(t) = 0, \\ & x(0) = 0, \\ & x(2) = 1. \end{aligned} \right.
4.2 Exercise 2 — Computational
Find stationary points of the functional
\mathcal{F}(x)=\int_a^b x^2 + 4xx^\prime+2(x^\prime)^2 \,\mathrm{d}t
with constraint
x(a) = x_a
First Variation
\mathcal{F}(x+\alpha\delta x)=\int_a^b (x+\alpha\delta x)^2 + 4(x+\alpha\delta x)(x^\prime+\alpha\delta x^\prime) +2(x^\prime+\alpha\delta x^\prime)^2 \,\mathrm{d}t
perform variation
\begin{aligned} \frac{\mathrm{d}}{\mathrm{d}\alpha} \mathcal{F}(x+\alpha\delta x) &= \underbrace{\frac{\mathrm{d}}{\mathrm{d}\alpha}\int_a^b}_{\longleftrightarrow} \cdots \mathrm{d}t \\ &= \underbrace{\int_a^b\frac{\mathrm{d}}{\mathrm{d}\alpha}}_{\longleftrightarrow} \cdots \mathrm{d}t \\ &= \int_a^b (x+\alpha\delta x)(2\delta x+4\delta x^\prime)+ 4(x^\prime+\alpha\delta x^\prime)(\delta x+\delta x^\prime) \,\mathrm{d}t \\ \end{aligned}
evaluating at \alpha=0:
\begin{aligned} \delta\mathcal{F}(x) &= \frac{\mathrm{d}}{\mathrm{d}\alpha} \mathcal{F}(x+\alpha\delta x)\bigg|_{\alpha=0} \\ &= \int_a^b x(2\delta x+4\delta x^\prime)+ 4x^\prime(\delta x+\delta x^\prime) \,\mathrm{d}t \\ &= \int_a^b (2x+4x^\prime)\delta x+ 4(x+x^\prime)\delta x^\prime \,\mathrm{d}t \end{aligned}
Integration by Parts
For the term 4(x+x^\prime)\delta x^\prime
\begin{aligned} \frac{\mathrm{d}}{\mathrm{d}t} \left( (x+x^\prime)\delta x \right) &= (x+x^\prime)\delta x^\prime+ \frac{\mathrm{d}}{\mathrm{d}t} \left( (x+x^\prime) \right)\delta x \\ &= (x+x^\prime)\delta x^\prime+ (x^\prime+x^{\prime\prime}) \delta x \end{aligned}
and
\begin{aligned} \int_a^b (x+x^\prime)\delta x^\prime \,\mathrm{d}t &= \int_a^b \frac{\mathrm{d}}{\mathrm{d}t} \left( (x+x^\prime)\delta x \right) \,\mathrm{d}t - \int_a^b (x^\prime+x^{\prime\prime}) \delta x \,\mathrm{d}t \\ &= (x+x^\prime)\delta x\bigg|_a^b - \int_a^b (x^\prime+x^{\prime\prime}) \delta x \,\mathrm{d}t \end{aligned}
so that
\begin{aligned} \delta\mathcal{F}(x) &= \int_a^b (2x+\cancel{4x^\prime}-\cancel{4x^{\prime}}-4x^{\prime\prime})\delta x \,\mathrm{d}t+\\ &\qquad 4(x(b)+x^\prime(b))\delta x(b)- 4\underbrace{\cancel{(x(a)+x^\prime(a))\delta x(a)}}_{\delta x(a)=0} \end{aligned}
Euler–Lagrange Equation
\begin{aligned} \delta x(b) & \implies x(b)+x^\prime(b) = 0 \\ \delta x & \implies 2x(t)-4x^{\prime\prime}(t) = 0 \\ \end{aligned}
Final Problem
\left\{\begin{aligned} x-2x^{\prime\prime} & = 0 \\ x(a) & = x_a \\ x(b)+x^\prime(b) & = 0 \end{aligned}\right.
The same result can be obtained using Euler-Lagrange equation
L(x,x',t) = x^2 + 4 x x^\prime + 2(x^\prime)^2
so that
\begin{aligned} \frac{\mathrm{d}}{\mathrm{d}t} \frac{\partial L(x,x',t)}{\partial x^\prime} - \frac{\partial L(x,x',t)}{\partial x} &= 0 \\ \frac{\mathrm{d}}{\mathrm{d}t} (4x+4x^{\prime}) - (2x+4x^{\prime}) &= 0 \\ 4x^{\prime\prime} -2x &= 0 \\ -2(x-2x^{\prime\prime})&= 0 \end{aligned}
and for the free boundary
0= \frac{\partial L(x,x',t)}{\partial x^\prime} \bigg|_{t=b} = (4x+4x^{\prime})\Big|_{t=b} = 4(x(b)+x^\prime(b)) = 0
4.3 Exercise 3 — Advanced
Find stationary points of the functional, assuming x'(t)>0:
\mathcal{F}(x) = \int_0^1 x^\prime (\log x^\prime)^2 \mathrm{d}t
with free endpoint values.
First Variation
\begin{aligned} \delta\mathcal{F}(x) &= \delta\int_0^1 x^\prime (\log x^\prime)^2 \mathrm{d}t\\ &= \int_0^1 \delta\left( x^\prime (\log x^\prime)^2 \right) \mathrm{d}t\\ &= \int_0^1 \delta x^\prime (\log x^\prime)^2 +2x^\prime\log x^\prime\frac{\delta x^\prime}{x^\prime} \mathrm{d}t\\ &= \int_0^1 \left( (\log x^\prime)^2 +2\log x^\prime\right) \delta x^\prime \mathrm{d}t \end{aligned}
Remark 4.1. Do not do this wrong argument: \delta x is arbitrary and so that using fundamental lemma of calculus of variations it follows
\color{red} (\log x^\prime)^2 +2\log x^\prime = 0
the lemma is true for \delta x not \delta x^\prime.
Integration by Parts
\begin{aligned} \frac{\mathrm{d}}{\mathrm{d}t}\left[ \left((\log x^\prime)^2 +2\log x^\prime\right) \delta x \right] & = \frac{\mathrm{d}}{\mathrm{d}t}\left[ (\log x^\prime)^2 +2\log x^\prime \right] \delta x \\ & + \left((\log x^\prime)^2 +2\log x^\prime\right) \delta x^\prime \end{aligned}
so that
\delta\mathcal{F}(x) = \left((\log x^\prime)^2 +2\log x^\prime\right) \delta x\Big|_0^1 - \int_0^1 \frac{\mathrm{d}}{\mathrm{d}t}\left[ (\log x^\prime)^2 +2\log x^\prime \right] \delta x \,\mathrm{d}t
Euler–Lagrange Equation
\begin{aligned} \delta x(a) & \implies (\log x^\prime(a))^2 +2\log x^\prime(a) = 0 \\ \delta x(b) & \implies (\log x^\prime(b))^2 +2\log x^\prime(b) = 0 \\ \delta x(t) & \implies \frac{\mathrm{d}}{\mathrm{d}t}\left[ (\log x^\prime)^2 +2\log x^\prime \right] = 0, \end{aligned}
Final Problem
\left\{ \begin{aligned} (\log x^\prime)^2 +2\log x^\prime & = C, \\ (\log x^\prime(a))^2 +2\log x^\prime(a) & = 0 \\ (\log x^\prime(b))^2 +2\log x^\prime(b) & = 0 \end{aligned} \right.
The natural boundary conditions force C=0 throughout the interval. Hence
\log x'\,\big(\log x'+2\big)=0,
so every smooth stationary function is affine with one of the two admissible slopes:
x(t)=c+t \qquad\text{or}\qquad x(t)=c+\mathrm e^{-2}t, \qquad c\in\mathbb R.