← Back

Variational Calculus

We seek a method of minimizing/maximizing functionals rather than ordinary functions. A functional is a mapping that takes in a function and outputs a scalar. The most familiar example is the definite integral.

Example functional:

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

Here, \(y=y(x)\) is the function being varied. We seek \(\overline{y}(x)\) that minimizes \(J[y]\). A classical problem is the Brachistochrone problem, minimizing the time for a bead to slide under gravity along a frictionless curve.

Brachistochrone problem diagram
Self-drawn Brachistochrone Problem

Bernoulli showed the time is

\[ \frac{1}{\sqrt{2g}}\int_a^b \sqrt{\frac{1+(y')^2}{y}}\,dx \]

General Theory

In standard calculus, minima are found by setting derivatives to zero. In variational calculus, we set the functional derivative equal to zero, yielding an ODE.

\[ \frac{df(x)}{dx}=0 \quad \Rightarrow \quad \text{Euler–Lagrange equation}. \]

For the functional

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

we want \(y(a)=A,\; y(b)=B\) and \(\overline{y}(x)\) minimizing \(J[y]\). Consider perturbations:

\[ \overline{y}(x)+\varepsilon \eta(x),\qquad \eta(a)=\eta(b)=0. \]

Define \(\phi(\varepsilon)=J[\overline{y}+\varepsilon\eta]\). Minimizing requires

\[ \left.\frac{d\phi}{d\varepsilon}\right|_{\varepsilon=0}=0. \]

Expanding:

\[ \int_a^b \left[ \frac{\partial F}{\partial \overline{y}}\,\eta(x) + \frac{\partial F}{\partial \overline{y}'}\,\eta'(x)\right] dx. \]

Integration by parts gives

\[ \int_a^b \left( \frac{\partial F}{\partial \overline{y}} - \frac{d}{dx}\frac{\partial F}{\partial \overline{y}'}\right)\eta(x)\,dx=0. \]

Since \(\eta\) is arbitrary, the integrand must vanish:

\[ \frac{\partial F}{\partial y} - \frac{d}{dx}\Big(\frac{\partial F}{\partial y'}\Big)=0. \]

This is the Euler–Lagrange Equation.

Example Problem

Consider

\[ J[y]=\int_0^1 \big(y^2+(y')^2\big)\,dx \]

with boundary conditions \(y(0)=0,\; y(2)=2\).

Here \(F(x,y,y')=y^2+(y')^2\). Compute:

\[ F_y=2y, \qquad F_{y'}=2y'. \]

So the Euler–Lagrange equation is

\[ 2y - \frac{d}{dx}(2y')=0 \;\;\Rightarrow\;\; y''-y=0. \]

The characteristic equation is \(\lambda^2-1=0 \implies \lambda=\pm 1\).

\[ y(x)=Ae^x+Be^{-x}. \]

Apply BCs: \(y(0)=0\implies A+B=0\). So \(A=-B\).

\[ y(2)=Ae^2+Be^{-2}=2. \]

Substitute \(A=-B\):

\[ -Be^2+Be^{-2}=2 \;\;\Rightarrow\;\; B=\frac{2}{-e^2+e^{-2}}\approx -0.28. \]

Then \(A=-B=0.28\). So

\[ y(x)=0.28e^x - 0.28e^{-x} \]

or equivalently

\[ y(x)=0.28\Big(e^x - \tfrac{1}{e^x}\Big). \]

This function minimizes the functional

\[ J[y]=\int_0^1\big(y^2+(y')^2\big)\,dx. \]