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.

First Variation of the Augmented Functional

The previous section introduced the augmented optimal-control functional, the costate vector, the endpoint multiplier, and the Hamiltonian. The next step is to compute the first variation of the augmented functional carefully enough that all endpoint and interior terms are retained.

This derivation is delicate for two reasons. First, the initial and final times may vary. Second, the state evaluated at a moving endpoint changes for two distinct reasons: the trajectory may change at a fixed time, and the endpoint time itself may move. Neglecting either contribution produces incorrect transversality conditions.

This section develops the endpoint portion of the derivation and prepares the integral variation that will be completed in the Hamiltonian-integral section.

Problem statement

Consider the optimal-control problem

minx(),u(),t0,tfJ=Φ ⁣(x(t0),t0,x(tf),tf)+t0tfL ⁣(x(t),u(t),t)dt,\begin{aligned} \min_{\boldsymbol{x}(\cdot),\boldsymbol{u}(\cdot),t_0,t_f}\quad J &= \Phi\!\left(\boldsymbol{x}(t_0),t_0,\boldsymbol{x}(t_f),t_f\right) + \int_{t_0}^{t_f} L\!\left(\boldsymbol{x}(t),\boldsymbol{u}(t),t\right)\,\mathrm{d} t, \end{aligned}
subject tox˙(t)=f ⁣(x(t),u(t),t),\begin{aligned} \text{subject to}\quad \dot{\boldsymbol{x}}(t) &= \boldsymbol{f}\!\left(\boldsymbol{x}(t),\boldsymbol{u}(t),t\right), \end{aligned}
ϕ ⁣(x(t0),t0,x(tf),tf)=0.\begin{aligned} \boldsymbol{\phi}\!\left(\boldsymbol{x}(t_0),t_0,\boldsymbol{x}(t_f),t_f\right) &=\boldsymbol{0}. \end{aligned}

The quantities have dimensions

x(t)Rn,u(t)Rm,ϕRq,λ(t)Rn,νRq.\begin{aligned} \boldsymbol{x}(t)&\in\mathbb{R}^n, &\boldsymbol{u}(t)&\in\mathbb{R}^m, &\boldsymbol{\phi}&\in\mathbb{R}^q, &\boldsymbol{\lambda}(t)&\in\mathbb{R}^n, &\boldsymbol{\nu}&\in\mathbb{R}^q. \end{aligned}

The endpoint function Φ\Phi is scalar-valued, whereas ϕ\boldsymbol{\phi} is vector-valued.

Augmented functional

Introduce the costate λ(t)\boldsymbol{\lambda}(t) and endpoint multiplier ν\boldsymbol{\nu}. The augmented functional is

Ja=Φ ⁣(x(t0),t0,x(tf),tf)νTϕ ⁣(x(t0),t0,x(tf),tf)+t0tf[L ⁣(x,u,t)+λT(f ⁣(x,u,t)x˙)]dt.\begin{aligned} J_a = &\Phi\!\left(\boldsymbol{x}(t_0),t_0,\boldsymbol{x}(t_f),t_f\right) - \boldsymbol{\nu}^{\mathsf{T}} \boldsymbol{\phi}\!\left(\boldsymbol{x}(t_0),t_0,\boldsymbol{x}(t_f),t_f\right) \nonumber\\ &+ \int_{t_0}^{t_f} \left[ L\!\left(\boldsymbol{x},\boldsymbol{u},t\right) + \boldsymbol{\lambda}^{\mathsf{T}} \left( \boldsymbol{f}\!\left(\boldsymbol{x},\boldsymbol{u},t\right)-\dot{\boldsymbol{x}} \right) \right] \,\mathrm{d} t. \end{aligned}

Define the Hamiltonian

H(x,u,λ,t)=L(x,u,t)+λTf(x,u,t).H(\boldsymbol{x},\boldsymbol{u},\boldsymbol{\lambda},t) = L(\boldsymbol{x},\boldsymbol{u},t) + \boldsymbol{\lambda}^{\mathsf{T}}\boldsymbol{f}(\boldsymbol{x},\boldsymbol{u},t).

Then

Ja=ΦuvecTϕ+t0tf(HλTx˙)dt.J_a = \Phi- uvec^{\mathsf{T}}\boldsymbol{\phi} + \int_{t_0}^{t_f} \left(H-\boldsymbol{\lambda}^{\mathsf{T}}\dot{\boldsymbol{x}}\right)\,\mathrm{d} t.

Moving-endpoint variations

Two distinct endpoint state variations

At the initial endpoint, distinguish

These quantities satisfy

δx0=δx(t0)+x˙(t0)δt0.\delta\boldsymbol{x}_0 = \delta\boldsymbol{x}(t_0) + \dot{\boldsymbol{x}}(t_0)\delta t_0.

Similarly,

δxf=δx(tf)+x˙(tf)δtf.\delta\boldsymbol{x}_f = \delta\boldsymbol{x}(t_f) + \dot{\boldsymbol{x}}(t_f)\delta t_f.

Equivalently,

δx(t0)=δx0x˙(t0)δt0,\begin{aligned} \delta\boldsymbol{x}(t_0) &= \delta\boldsymbol{x}_0- \dot{\boldsymbol{x}}(t_0)\delta t_0, \end{aligned}
δx(tf)=δxfx˙(tf)δtf.\begin{aligned} \delta\boldsymbol{x}(t_f) &= \delta\boldsymbol{x}_f- \dot{\boldsymbol{x}}(t_f)\delta t_f. \end{aligned}
A moving endpoint changes the endpoint state through the time shift as well as through a trajectory variation.

Figure 1:A moving endpoint changes the endpoint state through the time shift as well as through a trajectory variation.

Variation of the Mayer cost

Let

Φ=Φ ⁣(x(t0),t0,x(tf),tf).\Phi = \Phi\!\left(\boldsymbol{x}(t_0),t_0,\boldsymbol{x}(t_f),t_f\right).

A direct first-order expansion gives

δΦ=Φx(t0)δx(t0)+Φx(t0)x˙(t0)δt0+Φt0δt0+Φx(tf)δx(tf)+Φx(tf)x˙(tf)δtf+Φtfδtf.\begin{aligned} \delta\Phi = &\frac{\partial\Phi}{\partial\boldsymbol{x}(t_0)} \delta\boldsymbol{x}(t_0) + \frac{\partial\Phi}{\partial\boldsymbol{x}(t_0)} \dot{\boldsymbol{x}}(t_0)\delta t_0 + \frac{\partial\Phi}{\partial t_0}\delta t_0 \nonumber\\ &+ \frac{\partial\Phi}{\partial\boldsymbol{x}(t_f)} \delta\boldsymbol{x}(t_f) + \frac{\partial\Phi}{\partial\boldsymbol{x}(t_f)} \dot{\boldsymbol{x}}(t_f)\delta t_f + \frac{\partial\Phi}{\partial t_f}\delta t_f. \end{aligned}

Using (8), and (9), the pairs of terms involving the state and endpoint-time shift combine to give

δΦ=Φx(t0)δx0+Φt0δt0+Φx(tf)δxf+Φtfδtf.\boxed{ \delta\Phi = \frac{\partial\Phi}{\partial\boldsymbol{x}(t_0)}\delta\boldsymbol{x}_0 + \frac{\partial\Phi}{\partial t_0}\delta t_0 + \frac{\partial\Phi}{\partial\boldsymbol{x}(t_f)}\delta\boldsymbol{x}_f + \frac{\partial\Phi}{\partial t_f}\delta t_f }.

Orientation convention

Throughout this text, gradients of scalar functions with respect to vectors are taken as row vectors. Thus,

Φx(t0)R1×n,δx0Rn×1,\frac{\partial\Phi}{\partial\boldsymbol{x}(t_0)}\in\mathbb{R}^{1\times n}, \qquad \delta\boldsymbol{x}_0\in\mathbb{R}^{n\times 1},

so their product is scalar.

Variation of the endpoint constraints

The endpoint constraints are

ϕ=ϕ ⁣(x(t0),t0,x(tf),tf)Rq.\boldsymbol{\phi} = \boldsymbol{\phi}\!\left(\boldsymbol{x}(t_0),t_0,\boldsymbol{x}(t_f),t_f\right) \in\mathbb{R}^q.

Following exactly the same moving-endpoint argument used for Φ\Phi,

δϕ=ϕx(t0)δx0+ϕt0δt0+ϕx(tf)δxf+ϕtfδtf.\boxed{ \delta\boldsymbol{\phi} = \frac{\partial\boldsymbol{\phi}}{\partial\boldsymbol{x}(t_0)}\delta\boldsymbol{x}_0 + \frac{\partial\boldsymbol{\phi}}{\partial t_0}\delta t_0 + \frac{\partial\boldsymbol{\phi}}{\partial\boldsymbol{x}(t_f)}\delta\boldsymbol{x}_f + \frac{\partial\boldsymbol{\phi}}{\partial t_f}\delta t_f }.

Because ϕ\boldsymbol{\phi} is vector-valued,

ϕx(t0)Rq×n,ϕt0Rq×1,ϕx(tf)Rq×n,ϕtfRq×1.\begin{aligned} \frac{\partial\boldsymbol{\phi}}{\partial\boldsymbol{x}(t_0)}&\in\mathbb{R}^{q\times n}, & \frac{\partial\boldsymbol{\phi}}{\partial t_0}&\in\mathbb{R}^{q\times 1}, \\ \frac{\partial\boldsymbol{\phi}}{\partial\boldsymbol{x}(t_f)}&\in\mathbb{R}^{q\times n}, & \frac{\partial\boldsymbol{\phi}}{\partial t_f}&\in\mathbb{R}^{q\times 1}. \end{aligned}

Consequently, every term in (17) belongs to Rq\mathbb{R}^q, as required.

Dimension check

For example,

ϕx(t0)q×nδx0n×1Rq×1.\underbrace{\frac{\partial\boldsymbol{\phi}}{\partial\boldsymbol{x}(t_0)}}_{q\times n} \underbrace{\delta\boldsymbol{x}_0}_{n\times 1} \in\mathbb{R}^{q\times 1}.

Then

νT1×qδϕq×1R,\underbrace{\boldsymbol{\nu}^{\mathsf{T}}}_{1\times q} \underbrace{\delta\boldsymbol{\phi}}_{q\times 1} \in\mathbb{R},

which is consistent with the fact that νTϕ\boldsymbol{\nu}^{\mathsf{T}}\boldsymbol{\phi} is scalar.

Variation of the endpoint multiplier term

Apply the product rule to the scalar product νTϕ\boldsymbol{\nu}^{\mathsf{T}}\boldsymbol{\phi}:

δ(νTϕ)=δνTϕ+νTδϕ.\delta\left(\boldsymbol{\nu}^{\mathsf{T}}\boldsymbol{\phi}\right) = \delta\boldsymbol{\nu}^{\mathsf{T}}\boldsymbol{\phi} + \boldsymbol{\nu}^{\mathsf{T}}\delta\boldsymbol{\phi}.

Therefore,

δ(νTϕ)=δνTϕνTδϕ.\delta\left(-\boldsymbol{\nu}^{\mathsf{T}}\boldsymbol{\phi}\right) = -\delta\boldsymbol{\nu}^{\mathsf{T}}\boldsymbol{\phi} - \boldsymbol{\nu}^{\mathsf{T}}\delta\boldsymbol{\phi}.

Substituting (17),

δ(νTϕ)=νTϕx(t0)δx0νTϕt0δt0νTϕx(tf)δxfνTϕtfδtfδνTϕ.\begin{aligned} \delta\left(-\boldsymbol{\nu}^{\mathsf{T}}\boldsymbol{\phi}\right) = &-\boldsymbol{\nu}^{\mathsf{T}} \frac{\partial\boldsymbol{\phi}}{\partial\boldsymbol{x}(t_0)}\delta\boldsymbol{x}_0 - \boldsymbol{\nu}^{\mathsf{T}} \frac{\partial\boldsymbol{\phi}}{\partial t_0}\delta t_0 \nonumber\\ &-\boldsymbol{\nu}^{\mathsf{T}} \frac{\partial\boldsymbol{\phi}}{\partial\boldsymbol{x}(t_f)}\delta\boldsymbol{x}_f - \boldsymbol{\nu}^{\mathsf{T}} \frac{\partial\boldsymbol{\phi}}{\partial t_f}\delta t_f - \delta\boldsymbol{\nu}^{\mathsf{T}}\boldsymbol{\phi}. \end{aligned}

Because the final term is scalar,

δνTϕ=ϕTδν.\delta\boldsymbol{\nu}^{\mathsf{T}}\boldsymbol{\phi} = \boldsymbol{\phi}^{\mathsf{T}}\delta\boldsymbol{\nu}.

Thus the variation with respect to the endpoint multiplier may be written as

ϕTδν.-\boldsymbol{\phi}^{\mathsf{T}}\delta\boldsymbol{\nu}.

Combined endpoint variation

Combine (14) and (23). The variation of the terms outside the integral is

δ(ΦνTϕ)=[Φx(t0)νTϕx(t0)]δx0+[Φt0νTϕt0]δt0+[Φx(tf)νTϕx(tf)]δxf+[ΦtfνTϕtf]δtfϕTδν.\begin{aligned} \delta\left(\Phi-\boldsymbol{\nu}^{\mathsf{T}}\boldsymbol{\phi}\right) = &\left[ \frac{\partial\Phi}{\partial\boldsymbol{x}(t_0)} - \boldsymbol{\nu}^{\mathsf{T}}\frac{\partial\boldsymbol{\phi}}{\partial\boldsymbol{x}(t_0)} \right]\delta\boldsymbol{x}_0 \nonumber\\ &+ \left[ \frac{\partial\Phi}{\partial t_0} - \boldsymbol{\nu}^{\mathsf{T}}\frac{\partial\boldsymbol{\phi}}{\partial t_0} \right]\delta t_0 \nonumber\\ &+ \left[ \frac{\partial\Phi}{\partial\boldsymbol{x}(t_f)} - \boldsymbol{\nu}^{\mathsf{T}}\frac{\partial\boldsymbol{\phi}}{\partial\boldsymbol{x}(t_f)} \right]\delta\boldsymbol{x}_f \nonumber\\ &+ \left[ \frac{\partial\Phi}{\partial t_f} - \boldsymbol{\nu}^{\mathsf{T}}\frac{\partial\boldsymbol{\phi}}{\partial t_f} \right]\delta t_f - \boldsymbol{\phi}^{\mathsf{T}}\delta\boldsymbol{\nu}. \end{aligned}

This expression should be preserved because it will later be combined with endpoint terms generated by integration by parts in the integral variation.

Meaning of the multiplier variation

The variation δν\delta\boldsymbol{\nu} is arbitrary. Therefore, when the total first variation is eventually required to vanish for every admissible variation, the coefficient of δν\delta\boldsymbol{\nu} must vanish:

ϕ ⁣(x(t0),t0,x(tf),tf)=0.\boldsymbol{\phi}\!\left(\boldsymbol{x}(t_0),t_0,\boldsymbol{x}(t_f),t_f\right)=\boldsymbol{0}.

Thus variation with respect to the multiplier simply recovers the original endpoint constraints.

Preparation for the integral variation

The remaining part of the augmented functional is

I=t0tf(HλTx˙)dt.I = \int_{t_0}^{t_f} \left(H-\boldsymbol{\lambda}^{\mathsf{T}}\dot{\boldsymbol{x}}\right)\,\mathrm{d} t.

Its variation must account for

  1. motion of the lower integration limit,

  2. motion of the upper integration limit,

  3. variation of HH through x\boldsymbol{x}, u\boldsymbol{u}, and λ\boldsymbol{\lambda},

  4. variation of the product λTx˙\boldsymbol{\lambda}^{\mathsf{T}}\dot{\boldsymbol{x}},

  5. integration by parts of the term containing δx˙\delta\dot{\boldsymbol{x}}.

Using Leibniz’s rule,

δI=(HλTx˙)tfδtf(HλTx˙)t0δt0+t0tfδ(HλTx˙)dt.\begin{aligned} \delta I = &\left(H-\boldsymbol{\lambda}^{\mathsf{T}}\dot{\boldsymbol{x}}\right)_{t_f}\delta t_f - \left(H-\boldsymbol{\lambda}^{\mathsf{T}}\dot{\boldsymbol{x}}\right)_{t_0}\delta t_0 \nonumber\\ &+ \int_{t_0}^{t_f} \delta\left(H-\boldsymbol{\lambda}^{\mathsf{T}}\dot{\boldsymbol{x}}\right)\,\mathrm{d} t. \end{aligned}

The interior variation is

δ(HλTx˙)=δHδλTx˙λTδx˙.\delta\left(H-\boldsymbol{\lambda}^{\mathsf{T}}\dot{\boldsymbol{x}}\right) = \delta H - \delta\boldsymbol{\lambda}^{\mathsf{T}}\dot{\boldsymbol{x}} - \boldsymbol{\lambda}^{\mathsf{T}}\delta\dot{\boldsymbol{x}}.

Furthermore,

δH=Hxδx+Huδu+Hλδλ.\delta H = \frac{\partial H}{\partial\boldsymbol{x}}\delta\boldsymbol{x} + \frac{\partial H}{\partial\boldsymbol{u}}\delta\boldsymbol{u} + \frac{\partial H}{\partial\boldsymbol{\lambda}}\delta\boldsymbol{\lambda}.

The final term in (32) requires integration by parts. the Hamiltonian-integral section will complete this step, combine the resulting endpoint terms with (26), and collect the coefficients of all independent variations.

A compact derivation map

Logical structure of the first-variation derivation. This section completes the left branch and prepares the right branch.

Figure 2:Logical structure of the first-variation derivation. This section completes the left branch and prepares the right branch.

Worked symbolic check

Suppose

Φ=12x(tf)TQfx(tf)+αtf,\Phi = \frac{1}{2}\boldsymbol{x}(t_f)^{\mathsf{T}} Q_f\boldsymbol{x}(t_f) + \alpha t_f,

where Qf=QfTRn×nQ_f=Q_f^{\mathsf{T}}\in\mathbb{R}^{n\times n}, and suppose the endpoint constraint is

ϕ=C0x(t0)+Cfx(tf)d,\boldsymbol{\phi} = C_0\boldsymbol{x}(t_0)+C_f\boldsymbol{x}(t_f)-\boldsymbol{d},

with C0,CfRq×nC_0,C_f\in\mathbb{R}^{q\times n}.

Then

Φx(t0)=0T,Φt0=0,Φx(tf)=x(tf)TQf,Φtf=α,\begin{aligned} \frac{\partial\Phi}{\partial\boldsymbol{x}(t_0)}&=\boldsymbol{0}^{\mathsf{T}}, & \frac{\partial\Phi}{\partial t_0}&=0, \\ \frac{\partial\Phi}{\partial\boldsymbol{x}(t_f)}&=\boldsymbol{x}(t_f)^{\mathsf{T}} Q_f, & \frac{\partial\Phi}{\partial t_f}&=\alpha, \end{aligned}

and

ϕx(t0)=C0,ϕt0=0,ϕx(tf)=Cf,ϕtf=0.\begin{aligned} \frac{\partial\boldsymbol{\phi}}{\partial\boldsymbol{x}(t_0)}&=C_0, & \frac{\partial\boldsymbol{\phi}}{\partial t_0}&=\boldsymbol{0}, \\ \frac{\partial\boldsymbol{\phi}}{\partial\boldsymbol{x}(t_f)}&=C_f, & \frac{\partial\boldsymbol{\phi}}{\partial t_f}&=\boldsymbol{0}. \end{aligned}

Therefore,

δ(ΦνTϕ)=νTC0δx0+(x(tf)TQfνTCf)δxf+αδtfϕTδν.\begin{aligned} \delta(\Phi-\boldsymbol{\nu}^{\mathsf{T}}\boldsymbol{\phi}) = &-\boldsymbol{\nu}^{\mathsf{T}} C_0\delta\boldsymbol{x}_0 + \left(\boldsymbol{x}(t_f)^{\mathsf{T}} Q_f-\boldsymbol{\nu}^{\mathsf{T}} C_f\right)\delta\boldsymbol{x}_f \nonumber\\ &+ \alpha\delta t_f - \boldsymbol{\phi}^{\mathsf{T}}\delta\boldsymbol{\nu}. \end{aligned}

This result is dimensionally consistent:

νTC0R1×n,x(tf)TQfR1×n.\boldsymbol{\nu}^{\mathsf{T}} C_0 \in\mathbb{R}^{1\times n}, \qquad \boldsymbol{x}(t_f)^{\mathsf{T}} Q_f \in\mathbb{R}^{1\times n}.

Connection. The endpoint calculation is only half of the first variation; the Hamiltonian integral must now be varied with equal care.