Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Function Spaces, Functionals, and the Calculus of Variations

Optimal control is fundamentally different from ordinary finite-dimensional optimization because the unknown is generally not a point. Instead, the unknown is an entire function of time. A control input

u(t)\boldsymbol{u}(t)

assigns a command at every instant, while the corresponding state trajectory

x(t)\boldsymbol{x}(t)

describes the evolution of the system over an interval of time.

This distinction requires a new mathematical framework. Ordinary calculus studies changes in numbers or vectors. The calculus of variations studies changes in entire functions. The purpose of this section is to establish the foundational distinctions among points, functions, functionals, differences, and variations, and then derive the first-order necessary condition for the classical fixed-endpoint problem in the calculus of variations.

The final result is the Euler–Lagrange equation:

Lxddt(Lx˙)=0.\frac{\partial L}{\partial x} - \frac{\,\mathrm{d}}{\,\mathrm{d} t} \left( \frac{\partial L}{\partial \dot{x}} \right) =0.

Points and Functions

Points in finite-dimensional space

A point in nn-dimensional Euclidean space is denoted by

xRn.\boldsymbol{x}\in\mathbb{R}^n.

In component form,

x=[x1x2xn].\boldsymbol{x} = \begin{bmatrix} x_1\\ x_2\\ \vdots\\ x_n \end{bmatrix}.

The object x\boldsymbol{x} is one point. It contains nn numerical components, but it is still a finite-dimensional object.

Vector-valued functions

A vector-valued function of time is written as

x()Ω,\boldsymbol{x}(\cdot)\in\Omega,

where Ω\Omega denotes an appropriate function space. Evaluating the function at a specific time tt gives a point:

x(t)=[x1(t)x2(t)xn(t)]Rn.\boldsymbol{x}(t) = \begin{bmatrix} x_1(t)\\ x_2(t)\\ \vdots\\ x_n(t) \end{bmatrix} \in\mathbb{R}^n.

A function space may include smoothness, continuity, endpoint, or integrability requirements. Examples include

C([t0,tf])={x:[t0,tf]R  |  x is continuous},C1([t0,tf])={x:[t0,tf]R  |  x and x˙ are continuous}.\begin{aligned} C([t_0,t_f]) &= \left\{ x:[t_0,t_f]\rightarrow\mathbb{R} \; \middle| \; x \text{ is continuous} \right\},\\ C^1([t_0,t_f]) &= \left\{ x:[t_0,t_f]\rightarrow\mathbb{R} \; \middle| \; x \text{ and }\dot{x} \text{ are continuous} \right\}. \end{aligned}

Functions and Functionals

Ordinary functions

An ordinary function maps points to points. For example,

f:RnRm.\boldsymbol{f}:\mathbb{R}^n\rightarrow\mathbb{R}^m.

Given an input xRn\boldsymbol{x}\in\mathbb{R}^n, the function returns

f(x)Rm.\boldsymbol{f}(\boldsymbol{x})\in\mathbb{R}^m.

In the scalar case,

f:RnR.f:\mathbb{R}^n\rightarrow\mathbb{R}.

Functionals

A functional maps an entire function to a scalar:

J:ΩR.J:\Omega\rightarrow\mathbb{R}.

Thus,

x()ΩJ[x]R.x(\cdot)\in\Omega \quad\Longrightarrow\quad J[x]\in\mathbb{R}.

A fundamental example is the integral functional

J[x]=abx(τ)dτ.J[x] = \int_a^b x(\tau)\,\mathrm{d}\tau.

The variable τ\tau is a dummy variable of integration. Once the integration is complete, the result is a real number.

Why the Integration Variable Is Not an Output Variable

Consider

J[x]=t0tfL(x(t),x˙(t),t)dt.J[x] = \int_{t_0}^{t_f} L\bigl(x(t),\dot{x}(t),t\bigr)\,\mathrm{d} t.

Although the integrand depends explicitly on tt, the functional JJ is not a function of the dummy variable tt. The variable is integrated out over the interval [t0,tf][t_0,t_f].

The result depends on the chosen function x()x(\cdot), on the endpoints, and on the known integrand LL, but not on the dummy variable remaining after integration.

Control as a Function

A control input is usually a function of time:

u:[t0,tf]Rm.\boldsymbol{u}:[t_0,t_f]\rightarrow\mathbb{R}^m.

At each time tt, the control specifies a command

u(t)Rm.\boldsymbol{u}(t)\in\mathbb{R}^m.

For a vehicle, controls might include steering angle, throttle, and braking force. The defining feature of a control is that it can be selected, subject to allowable limits such as

uminu(t)umax.\boldsymbol{u}_{\min} \le \boldsymbol{u}(t) \le \boldsymbol{u}_{\max}.

The goal of optimal control is to determine an entire admissible function u(t)\boldsymbol{u}^*(t) that guides the dynamical system toward a desired goal while optimizing a performance measure.

Differences and Variations

Difference between points

Let

xRn\boldsymbol{x}\in\mathbb{R}^n

and consider a second point

y=x+Δx.\boldsymbol{y} = \boldsymbol{x} + \Delta\boldsymbol{x}.

Then

Δx=yx\Delta\boldsymbol{x} = \boldsymbol{y} - \boldsymbol{x}

is the difference or increment between two points.

Variation of a function

For a function x()x(\cdot), a perturbed function is written

x~(t)=x(t)+δx(t).\widetilde{x}(t) = x(t) + \delta x(t).

Here δx(t)\delta x(t) is called the variation of x(t)x(t). It is itself a function.

A variation perturbs the entire function, not merely one point.

Figure 1:A variation perturbs the entire function, not merely one point.

Increments of Functions and Functionals

Increment of an ordinary function

Let

f:RnR.f:\mathbb{R}^n\rightarrow\mathbb{R}.

The increment in ff induced by Δq\Delta\boldsymbol{q} is

Δf=f(q+Δq)f(q).\Delta f = f(\boldsymbol{q}+\Delta\boldsymbol{q}) - f(\boldsymbol{q}).

A first-order Taylor expansion gives

Δf=f(q)Δq+O(Δq2).\Delta f = \nabla f(\boldsymbol{q})^\top\Delta\boldsymbol{q} + \mathcal{O}\left(\|\Delta\boldsymbol{q}\|^2\right).

Increment of a functional

Let

J:ΩR.J:\Omega\rightarrow\mathbb{R}.

The increment of JJ produced by the perturbed function

q()+δq()q(\cdot)+\delta q(\cdot)

is

ΔJ=J[q+δq]J[q].\Delta J = J[q+\delta q] - J[q].

The first-order portion of this increment is called the first variation:

δJ.\delta J.

Formally,

J[q+ϵη]=J[q]+ϵδJ[q;η]+O(ϵ2),J[q+\epsilon\eta] = J[q] + \epsilon\,\delta J[q;\eta] + \mathcal{O}(\epsilon^2),

where η(t)\eta(t) is an admissible direction and ϵ\epsilon is a scalar perturbation parameter.

Equivalently,

δJ[q;η]=ddϵJ[q+ϵη]ϵ=0.\delta J[q;\eta] = \left. \frac{\,\mathrm{d}}{\,\mathrm{d}\epsilon} J[q+\epsilon\eta] \right|_{\epsilon=0}.

Local and Global Minima

Minima of ordinary functions

A point qRn\boldsymbol{q}^*\in\mathbb{R}^n is a local minimum of ff if there exists a neighborhood of q\boldsymbol{q}^* such that

f(q+Δq)f(q)f(\boldsymbol{q}^*+\Delta\boldsymbol{q}) \ge f(\boldsymbol{q}^*)

for all sufficiently small Δq\Delta\boldsymbol{q}.

It is a global minimum if

f(q)f(q)qRn.f(\boldsymbol{q}) \ge f(\boldsymbol{q}^*) \qquad \forall \boldsymbol{q}\in\mathbb{R}^n.

Extrema of functionals

A function x()Ωx^*(\cdot)\in\Omega is a local minimum of JJ if

J[x+δx]J[x]J[x^*+\delta x] \ge J[x^*]

for all sufficiently small admissible variations δx()\delta x(\cdot).

It is a global minimum if

J[x]J[x]x()Ω.J[x] \ge J[x^*] \qquad \forall x(\cdot)\in\Omega.

More generally, minima and maxima of functionals are referred to as extrema.

Ordinary Calculus and the Calculus of Variations

Ordinary calculus determines extrema of functions by analyzing derivatives with respect to finite-dimensional variables.

For example, if

f:RR,f:\mathbb{R}\rightarrow\mathbb{R},

then an interior extremum satisfies

dfdx=0.\frac{\,\mathrm{d} f}{\,\mathrm{d} x}=0.

The calculus of variations performs an analogous task for functionals. An extremizing function x()x^*(\cdot) must satisfy

δJ=0\delta J=0

for all admissible first-order variations.

The Classical Fixed-Endpoint Problem

Consider the functional

J[x]=t0tfL(x(t),x˙(t),t)dt,J[x] = \int_{t_0}^{t_f} L\bigl(x(t),\dot{x}(t),t\bigr)\,\mathrm{d} t,

where LL is known and the function x(t)x(t) is unknown.

Assume that

x(t0)=x0,x(tf)=xf,\begin{aligned} x(t_0)&=x_0,\\ x(t_f)&=x_f, \end{aligned}

and that t0t_0, tft_f, x0x_0, and xfx_f are fixed.

The objective is to determine a function

x(t)x^*(t)

that makes J[x]J[x] stationary.

Many admissible functions can connect the same fixed endpoints. The calculus of variations identifies the extremizing path.

Figure 2:Many admissible functions can connect the same fixed endpoints. The calculus of variations identifies the extremizing path.

Admissible Variations

Let the perturbed path be

x~(t)=x(t)+ϵη(t),\widetilde{x}(t) = x(t) + \epsilon\eta(t),

where η(t)\eta(t) is an arbitrary smooth variation function.

Because the endpoint values are fixed, the perturbed path must satisfy

x~(t0)=x0,x~(tf)=xf.\begin{aligned} \widetilde{x}(t_0)&=x_0,\\ \widetilde{x}(t_f)&=x_f. \end{aligned}

Substituting (49) gives

x(t0)+ϵη(t0)=x0,x(tf)+ϵη(tf)=xf.\begin{aligned} x(t_0)+\epsilon\eta(t_0)&=x_0,\\ x(t_f)+\epsilon\eta(t_f)&=x_f. \end{aligned}

Since x(t0)=x0x(t_0)=x_0 and x(tf)=xfx(t_f)=x_f, it follows that

η(t0)=0,η(tf)=0.\eta(t_0)=0, \qquad \eta(t_f)=0.

Equivalently,

δx(t0)=0,δx(tf)=0.\delta x(t_0)=0, \qquad \delta x(t_f)=0.

Derivation of the First Variation

The first variation of (46) is

δJ=δt0tfL(x,x˙,t)dt.\delta J = \delta \int_{t_0}^{t_f} L\bigl(x,\dot{x},t\bigr)\,\mathrm{d} t.

Because the integration limits are fixed, the variation can be moved inside the integral:

δJ=t0tfδLdt.\delta J = \int_{t_0}^{t_f} \delta L\,\mathrm{d} t.

To first order,

δL=Lxδx+Lx˙δx˙.\delta L = \frac{\partial L}{\partial x}\delta x + \frac{\partial L}{\partial\dot{x}} \delta\dot{x}.

There is no term involving a variation δt\delta t because tt is the fixed independent variable in the present problem.

Substitution into (55) gives

δJ=t0tf[Lxδx+Lx˙δx˙]dt.\delta J = \int_{t_0}^{t_f} \left[ \frac{\partial L}{\partial x}\delta x + \frac{\partial L}{\partial\dot{x}} \delta\dot{x} \right]\,\mathrm{d} t.

Dependence of δx˙\delta \dot{x} on δx\delta x

The variations δx\delta x and δx˙\delta\dot{x} are not independent because

x˙(t)=dxdt.\dot{x}(t) = \frac{\,\mathrm{d} x}{\,\mathrm{d} t}.

Under standard smoothness assumptions, variation and differentiation commute:

δx˙=ddtδx.\delta\dot{x} = \frac{\,\mathrm{d}}{\,\mathrm{d} t}\delta x.

Therefore,

δJ=t0tf[Lxδx+Lx˙ddt(δx)]dt.\delta J = \int_{t_0}^{t_f} \left[ \frac{\partial L}{\partial x}\delta x + \frac{\partial L}{\partial\dot{x}} \frac{\,\mathrm{d}}{\,\mathrm{d} t}(\delta x) \right]\,\mathrm{d} t.

Integration by Parts

Recall the integration-by-parts identity

abu(t)v˙(t)dt=u(t)v(t)ababu˙(t)v(t)dt.\int_a^b u(t)\dot{v}(t)\,\mathrm{d} t = \left. u(t)v(t) \right|_a^b - \int_a^b \dot{u}(t)v(t)\,\mathrm{d} t.

Choose

u(t)=Lx˙,v(t)=δx(t).u(t) = \frac{\partial L}{\partial\dot{x}}, \qquad v(t) = \delta x(t).

Then

t0tfLx˙ddt(δx)dt=Lx˙δxt0tft0tfddt(Lx˙)δxdt.\begin{aligned} \int_{t_0}^{t_f} \frac{\partial L}{\partial\dot{x}} \frac{\,\mathrm{d}}{\,\mathrm{d} t}(\delta x) \,\mathrm{d} t &= \left. \frac{\partial L}{\partial\dot{x}} \delta x \right|_{t_0}^{t_f} \nonumber\\ &\quad - \int_{t_0}^{t_f} \frac{\,\mathrm{d}}{\,\mathrm{d} t} \left( \frac{\partial L}{\partial\dot{x}} \right) \delta x \,\mathrm{d} t. \end{aligned}

Substitution into (60) yields

δJ=t0tf[Lxddt(Lx˙)]δxdt+Lx˙δxt0tf.\begin{aligned} \delta J &= \int_{t_0}^{t_f} \left[ \frac{\partial L}{\partial x} - \frac{\,\mathrm{d}}{\,\mathrm{d} t} \left( \frac{\partial L}{\partial\dot{x}} \right) \right] \delta x \,\mathrm{d} t \nonumber\\ &\quad + \left. \frac{\partial L}{\partial\dot{x}} \delta x \right|_{t_0}^{t_f}. \end{aligned}

Because the endpoints are fixed,

δx(t0)=0,δx(tf)=0.\delta x(t_0)=0, \qquad \delta x(t_f)=0.

Hence the boundary term vanishes:

Lx˙δxt0tf=0.\left. \frac{\partial L}{\partial\dot{x}} \delta x \right|_{t_0}^{t_f} = 0.

Thus,

δJ=t0tf[Lxddt(Lx˙)]δxdt.\delta J = \int_{t_0}^{t_f} \left[ \frac{\partial L}{\partial x} - \frac{\,\mathrm{d}}{\,\mathrm{d} t} \left( \frac{\partial L}{\partial\dot{x}} \right) \right] \delta x \,\mathrm{d} t.

The Fundamental Lemma of the Calculus of Variations

Applying the lemma to (67), and noting that δx(t)\delta x(t) is otherwise arbitrary, gives the necessary condition

Lxddt(Lx˙)=0.\frac{\partial L}{\partial x} - \frac{\,\mathrm{d}}{\,\mathrm{d} t} \left( \frac{\partial L}{\partial\dot{x}} \right) = 0.

Interpretation of the Euler–Lagrange Equation

The Euler–Lagrange equation is not the extremizing function itself. It is a differential equation that the extremizing function must satisfy.

The solution procedure is therefore:

  1. compute

Lx;\frac{\partial L}{\partial x};
  1. compute

Lx˙;\frac{\partial L}{\partial\dot{x}};
  1. differentiate the latter with respect to time:

ddt(Lx˙);\frac{\,\mathrm{d}}{\,\mathrm{d} t} \left( \frac{\partial L}{\partial\dot{x}} \right);
  1. form the Euler–Lagrange differential equation;

  2. solve the differential equation subject to the endpoint conditions.

Worked Example: Minimizing the Integral of Squared Slope

Consider

J[x]=t0tf12x˙2(t)dtJ[x] = \int_{t_0}^{t_f} \frac{1}{2}\dot{x}^2(t)\,\mathrm{d} t

subject to

x(t0)=x0,x(tf)=xf.x(t_0)=x_0, \qquad x(t_f)=x_f.

Here,

L(x,x˙,t)=12x˙2.L(x,\dot{x},t) = \frac{1}{2}\dot{x}^2.

Then

Lx=0,\frac{\partial L}{\partial x}=0,

and

Lx˙=x˙.\frac{\partial L}{\partial\dot{x}} = \dot{x}.

The Euler–Lagrange equation becomes

0ddt(x˙)=0,0 - \frac{\,\mathrm{d}}{\,\mathrm{d} t}(\dot{x}) = 0,

or

x¨=0.\ddot{x}=0.

Integrating twice gives

x(t)=c1t+c2.x(t)=c_1t+c_2.

Using the endpoint conditions,

x(t)=x0+xfx0tft0(tt0).x^*(t) = x_0 + \frac{x_f-x_0}{t_f-t_0} (t-t_0).

Thus, the extremizing path is the straight line joining the two endpoints.

Worked Example: A Functional with a Trivial Minimizer

Consider

J[x]=abx2(t)dt.J[x] = \int_a^b x^2(t)\,\mathrm{d} t.

Because

x2(t)0x^2(t)\ge 0

for all tt, it follows that

J[x]0.J[x]\ge 0.

The lower bound is achieved by

x(t)=0,x^*(t)=0,

which yields

J[x]=0.J[x^*]=0.

The Euler–Lagrange equation confirms this result. Here

L=x2,L=x^2,

so

Lx=2x,Lx˙=0.\frac{\partial L}{\partial x}=2x, \qquad \frac{\partial L}{\partial\dot{x}}=0.

Therefore,

2x=0,2x=0,

and hence

x(t)=0.x^*(t)=0.

Vector Form of the Euler–Lagrange Equation

Let

x(t)Rn\boldsymbol{x}(t)\in\mathbb{R}^n

and consider

J[x]=t0tfL(x(t),x˙(t),t)dt.J[\boldsymbol{x}] = \int_{t_0}^{t_f} L\bigl(\boldsymbol{x}(t),\dot{\boldsymbol{x}}(t),t\bigr)\,\mathrm{d} t.

The Euler–Lagrange equation becomes

Lxddt(Lx˙)=0.\frac{\partial L}{\partial\boldsymbol{x}} - \frac{\,\mathrm{d}}{\,\mathrm{d} t} \left( \frac{\partial L}{\partial\dot{\boldsymbol{x}}} \right) = \boldsymbol{0}.

Componentwise,

Lxiddt(Lx˙i)=0,i=1,,n.\frac{\partial L}{\partial x_i} - \frac{\,\mathrm{d}}{\,\mathrm{d} t} \left( \frac{\partial L}{\partial\dot{x}_i} \right) = 0, \qquad i=1,\ldots,n.

Connection to Lagrangian Mechanics

In analytical mechanics, the Lagrangian is often defined as

L(q,q˙,t)=T(q,q˙,t)V(q,t),\mathcal{L}(\boldsymbol{q},\dot{\boldsymbol{q}},t) = T(\boldsymbol{q},\dot{\boldsymbol{q}},t) - V(\boldsymbol{q},t),

where TT is kinetic energy and VV is potential energy.

The action functional is

S[q]=t0tfL(q,q˙,t)dt.\mathcal{S}[\boldsymbol{q}] = \int_{t_0}^{t_f} \mathcal{L}(\boldsymbol{q},\dot{\boldsymbol{q}},t)\,\mathrm{d} t.

Hamilton’s principle states that the physically realized trajectory renders the action stationary:

δS=0.\delta\mathcal{S}=0.

The resulting Euler–Lagrange equations are

Lqiddt(Lq˙i)=0.\frac{\partial\mathcal{L}}{\partial q_i} - \frac{\,\mathrm{d}}{\,\mathrm{d} t} \left( \frac{\partial\mathcal{L}}{\partial\dot{q}_i} \right) = 0.

Thus, the same mathematical structure that determines stationary functionals also generates the equations of motion in classical mechanics.

Principle of Stationary Action

The phrase principle of least action is commonly used, but the more precise statement is that the physical path makes the action stationary. The path may correspond to a minimum, maximum, or saddle-type stationary value depending on the problem.

Therefore,

δS=0\delta\mathcal{S}=0

is the fundamental first-order condition.

Important Assumptions in the Derivation

The derivation of (71) relied on the following assumptions:

  1. the endpoint times t0t_0 and tft_f are fixed;

  2. the endpoint values x(t0)x(t_0) and x(tf)x(t_f) are fixed;

  3. the admissible functions are sufficiently smooth;

  4. the integrand L(x,x˙,t)L(x,\dot{x},t) is differentiable in its arguments;

  5. the variation and time differentiation commute;

  6. only first-order variation terms are retained.

When endpoint values or endpoint times are free, additional boundary conditions arise. These are called natural boundary conditions or transversality conditions.

Chapter Summary

The principal ideas developed in this section are:

  1. A point xRn\boldsymbol{x}\in\mathbb{R}^n and a function x()Ω\boldsymbol{x}(\cdot)\in\Omega are fundamentally different mathematical objects.

  2. An ordinary function maps points to values:

f:RnRm.f:\mathbb{R}^n\rightarrow\mathbb{R}^m.
  1. A functional maps functions to real numbers:

J:ΩR.J:\Omega\rightarrow\mathbb{R}.
  1. A finite-dimensional increment is denoted by Δx\Delta\boldsymbol{x}, while a functional variation is denoted by δx(t)\delta x(t).

  2. The first variation δJ\delta J is the first-order change in a functional caused by a variation in its input function.

  3. For the fixed-endpoint problem

J[x]=t0tfL(x,x˙,t)dt,J[x] = \int_{t_0}^{t_f} L(x,\dot{x},t)\,\mathrm{d} t,

the first-order stationarity condition is

δJ=0.\delta J=0.
  1. Integration by parts converts the dependence on δx˙\delta\dot{x} into dependence on δx\delta x.

  2. Fixed endpoints imply

δx(t0)=δx(tf)=0.\delta x(t_0)=\delta x(t_f)=0.
  1. The resulting Euler–Lagrange equation is

Lxddt(Lx˙)=0.\frac{\partial L}{\partial x} - \frac{\,\mathrm{d}}{\,\mathrm{d} t} \left( \frac{\partial L}{\partial\dot{x}} \right) = 0.
  1. The Euler–Lagrange equation is a necessary condition, not a guarantee of a minimum.

  2. The same equation appears in classical mechanics through Hamilton’s principle of stationary action.

Connection. Once interior variations are understood, the next question is what changes when the endpoints are not fixed; endpoint variations provide that extension.