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.

Hamiltonian Conservation, Minimum-Time Control, and Bang–Bang Solutions

This section develops several important consequences of the Hamiltonian formulation and applies Pontryagin’s Minimum Principle to a classic bounded-control problem.

The main topics are:

  1. the evolution of the Hamiltonian along an optimal trajectory;

  2. conditions under which the Hamiltonian is constant;

  3. conditions under which the optimal Hamiltonian is identically zero;

  4. the minimum-time double-integrator problem;

  5. bang–bang control;

  6. switching functions and switching times;

  7. state-space switching curves; and

  8. an introduction to singular arcs.

Hamiltonian Evolution Along an Optimal Trajectory

Consider 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).

Suppose the optimal control has been obtained in feedback form:

u=u(x,λ,t).\boldsymbol{u}^* = \boldsymbol{u}^*(\boldsymbol{x}^*,\boldsymbol{\lambda}^*,t).

After substitution, the optimal Hamiltonian can be viewed as

H=H(x,λ,t).H^* = H(\boldsymbol{x}^*,\boldsymbol{\lambda}^*,t).

The canonical equations are

x˙=Hλ,λ˙=Hx.\begin{aligned} \dot{\boldsymbol{x}}^* &= \frac{\partial H}{\partial \boldsymbol{\lambda}}, \\ \dot{\boldsymbol{\lambda}}^* &= - \frac{\partial H}{\partial \boldsymbol{x}}. \end{aligned}

For clarity, write the scalar components as

x˙i=Hλi,λ˙i=Hxi,i=1,,n.\begin{aligned} \dot{x}_i^* &= \frac{\partial H}{\partial \lambda_i}, \\ \dot{\lambda}_i^* &= - \frac{\partial H}{\partial x_i}, \qquad i=1,\ldots,n. \end{aligned}

The total derivative of the Hamiltonian is

dHdt=i=1n(Hxix˙i+Hλiλ˙i)+Ht.\frac{\,\mathrm{d} H^*}{\,\mathrm{d} t} = \sum_{i=1}^{n} \left( \frac{\partial H}{\partial x_i}\dot{x}_i^* + \frac{\partial H}{\partial \lambda_i}\dot{\lambda}_i^* \right) + \frac{\partial H}{\partial t}.

Substituting the canonical equations gives

dHdt=i=1n(HxiHλiHλiHxi)+Ht=Ht.\begin{aligned} \frac{\,\mathrm{d} H^*}{\,\mathrm{d} t} &= \sum_{i=1}^{n} \left( \frac{\partial H}{\partial x_i} \frac{\partial H}{\partial \lambda_i} - \frac{\partial H}{\partial \lambda_i} \frac{\partial H}{\partial x_i} \right) + \frac{\partial H}{\partial t} \\ &= \frac{\partial H}{\partial t}. \end{aligned}

Therefore,

dHdt=Ht.\boxed{ \frac{\,\mathrm{d} H^*}{\,\mathrm{d} t} = \frac{\partial H}{\partial t}. }

When Is the Hamiltonian Constant?

If the Hamiltonian has no explicit time dependence,

Ht=0,\frac{\partial H}{\partial t}=0,

then

dHdt=0.\frac{\,\mathrm{d} H^*}{\,\mathrm{d} t}=0.

Hence,

H(t)=constant.\boxed{ H^*(t)=\text{constant}. }

This result does not require that the state or costate be constant. Their contributions cancel through the canonical equations.

When Is the Optimal Hamiltonian Zero?

The statement

H(t)0H^*(t)\equiv 0

requires more than a free final time.

For a problem with endpoint cost

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

and endpoint constraints

ϕ ⁣(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},

the final-time transversality condition is

H(tf)=Φtf+νTϕtf.H(t_f) = - \frac{\partial \Phi}{\partial t_f} + \boldsymbol{\nu}^{\mathsf{T}} \frac{\partial \boldsymbol{\phi}}{\partial t_f}.

If:

  1. the Hamiltonian has no explicit time dependence;

  2. the final time is free;

  3. the terminal cost has no explicit dependence on tft_f; and

  4. the terminal constraints have no explicit dependence on tft_f,

then

H(tf)=0.H^*(t_f)=0.

Since HH^* is constant,

H(t)0.\boxed{ H^*(t)\equiv 0. }

Minimum-Time Double-Integrator Problem

Consider a point mass subject to a bounded force. After normalization, the dynamics are

x¨=u,\ddot{x}=u,

with

u(t)1.|u(t)|\leq 1.

Define the state variables

x1=x,x2=x˙.x_1=x, \qquad x_2=\dot{x}.

Then

x˙1=x2,x˙2=u.\begin{aligned} \dot{x}_1 &= x_2,\\ \dot{x}_2 &= u. \end{aligned}

The boundary conditions are

x1(0)=x10,x2(0)=x20,x1(tf)=0,x2(tf)=0.\begin{aligned} x_1(0)&=x_{10},\\ x_2(0)&=x_{20},\\ x_1(t_f)&=0,\\ x_2(t_f)&=0. \end{aligned}

The goal is to minimize transfer time:

minu(),tfJ=tf.\boxed{ \min_{u(\cdot),\,t_f} J=t_f. }

Equivalently,

J=0tf1dt.J = \int_0^{t_f}1\,\mathrm{d} t.

The admissible control set is

U=[1,1].\mathcal{U}=[-1,1].

Hamiltonian for the Minimum-Time Problem

Using the integral representation of time, the Hamiltonian is

H=1+λ1x2+λ2u.H = 1+\lambda_1x_2+\lambda_2u.

Some sign conventions absorb the constant 1 differently, but the control-dependent term is always

λ2u.\lambda_2u.

Because the system is autonomous and the final time is free with no explicit terminal-time dependence,

H(t)0.H^*(t)\equiv 0.

Why Stationarity Does Not Determine the Control

The stationarity derivative is

Hu=λ2.\frac{\partial H}{\partial u} = \lambda_2.

This derivative does not contain uu. Therefore, the interior stationarity equation

Hu=0\frac{\partial H}{\partial u}=0

does not provide an explicit formula for the optimal control.

This is expected because the Hamiltonian is linear in uu, so its minimum over a closed interval generally occurs at one of the bounds.

Pontryagin’s Minimum Principle

The optimal control satisfies

u(t)arg minu[1,1]H(x(t),u,λ(t)).u^*(t) \in \operatorname*{arg\,min}_{u\in[-1,1]} H(x^*(t),u,\lambda^*(t)).

Since only the term λ2u\lambda_2u depends on uu,

u(t)arg minu[1,1]λ2(t)u.u^*(t) \in \operatorname*{arg\,min}_{u\in[-1,1]} \lambda_2(t)u.

Hence,

u(t)={1,λ2(t)>0,+1,λ2(t)<0.\boxed{ u^*(t) = \begin{cases} -1, & \lambda_2(t)>0,\\[1mm] +1, & \lambda_2(t)<0. \end{cases} }

Equivalently,

u(t)=sgn ⁣(λ2(t))\boxed{ u^*(t) = -\operatorname{sgn}\!\left(\lambda_2(t)\right) }

whenever λ2(t)0\lambda_2(t)\neq 0.

The switching function is

σ(t)=Hu=λ2(t).\sigma(t) = \frac{\partial H}{\partial u} = \lambda_2(t).

Costate Dynamics

The costate equations are

λ˙1=Hx1=0,λ˙2=Hx2=λ1.\begin{aligned} \dot{\lambda}_1 &= -\frac{\partial H}{\partial x_1} = 0, \\ \dot{\lambda}_2 &= -\frac{\partial H}{\partial x_2} = -\lambda_1. \end{aligned}

Thus,

λ1(t)=λˉ1,\lambda_1(t)=\bar{\lambda}_1,

where λˉ1\bar{\lambda}_1 is constant.

Integrating the second equation gives

λ2(t)=λˉ1t+λˉ2.\lambda_2(t) = -\bar{\lambda}_1t+\bar{\lambda}_2.

Therefore, λ2\lambda_2 is an affine function of time.

Number of Possible Switches

Because λ2(t)\lambda_2(t) is a straight line, it can cross zero at most once unless it is identically zero.

Therefore, the optimal control can have at most one switching time.

The only possible control structures are:

  1. u(t)+1u^*(t)\equiv +1;

  2. u(t)1u^*(t)\equiv -1;

  3. u(t)u^*(t) switches from +1 to -1; or

  4. u(t)u^*(t) switches from -1 to +1.

Excluding an Identically Zero Switching Function

If

λ2(t)0\lambda_2(t)\equiv 0

on an interval, then

λ˙2=λ1=0,\dot{\lambda}_2=-\lambda_1=0,

so

λ1(t)0.\lambda_1(t)\equiv 0.

This would imply

λ(t)0.\boldsymbol{\lambda}(t)\equiv\boldsymbol{0}.

Such a trivial multiplier violates the nontriviality condition of Pontryagin’s Minimum Principle. Therefore, the switching function cannot vanish identically on an interval for this problem.

Hence, no singular arc is present in the minimum-time double integrator.

State Trajectories Along Constant-Control Arcs

Let

u=s,s{1,+1}.u=s, \qquad s\in\{-1,+1\}.

Then

x˙1=x2,x˙2=s.\begin{aligned} \dot{x}_1&=x_2,\\ \dot{x}_2&=s. \end{aligned}

Integrating from an initial point (x10,x20)(x_{10},x_{20}) gives

x2(t)=x20+st,x1(t)=x10+x20t+12st2.\begin{aligned} x_2(t) &= x_{20}+st, \\ x_1(t) &= x_{10}+x_{20}t+\frac{1}{2}st^2. \end{aligned}

Eliminate time using

t=x2x20s.t = \frac{x_2-x_{20}}{s}.

Since s2=1s^2=1,

x1=x10+s2(x22x202).\boxed{ x_1 = x_{10} + \frac{s}{2} \left( x_2^2-x_{20}^2 \right). }

Thus, constant-control trajectories are parabolas in the (x1,x2)(x_1,x_2) phase plane.

Switching Curves Through the Origin

For a trajectory that reaches the origin under a constant control ss, set

x1=0,x2=0x_1=0, \qquad x_2=0

in (47). The initial point on such a terminal arc must satisfy

0=x1s2x22.0 = x_1 - \frac{s}{2}x_2^2.

Hence,

x1=s2x22.\boxed{ x_1 = \frac{s}{2}x_2^2. }

Equivalently, the two switching curves are

x1=12x22,for u=+1,x1=12x22,for u=1.\begin{aligned} x_1&=\frac{1}{2}x_2^2, &&\text{for }u=+1, \\ x_1&=-\frac{1}{2}x_2^2, &&\text{for }u=-1. \end{aligned}

A common compact representation is

x1=12x2x2.\boxed{ x_1 = -\frac{1}{2}x_2|x_2|. }

This curve separates regions of the state space associated with different initial control actions.

State-Space Interpretation

If the initial point lies directly on a terminal switching curve, the origin can be reached using a single constant control.

Otherwise:

  1. apply one extreme control to move toward the appropriate switching curve;

  2. switch control when the trajectory reaches the curve; and

  3. apply the opposite extreme control until the state reaches the origin.

Switching curves for the minimum-time double integrator separate the terminal arcs associated with the two extreme controls.

Figure 1:Switching curves for the minimum-time double integrator separate the terminal arcs associated with the two extreme controls.

Piecewise State Solution with One Switch

Suppose the control switches from -1 to +1 at t=tst=t_s.

For 0tts0\leq t\leq t_s,

x2(t)=x20t,x1(t)=x10+x20t12t2.\begin{aligned} x_2(t) &= x_{20}-t, \\ x_1(t) &= x_{10}+x_{20}t-\frac{1}{2}t^2. \end{aligned}

Define

x2s=x2(ts),x1s=x1(ts).\begin{aligned} x_{2s}&=x_2(t_s),\\ x_{1s}&=x_1(t_s). \end{aligned}

For tsttft_s\leq t\leq t_f,

x2(t)=x2s+(tts),x1(t)=x1s+x2s(tts)+12(tts)2.\begin{aligned} x_2(t) &= x_{2s}+(t-t_s), \\ x_1(t) &= x_{1s} + x_{2s}(t-t_s) + \frac{1}{2}(t-t_s)^2. \end{aligned}

For the reverse switch, from +1 to -1, the signs reverse:

x2(t)=x20+t,x1(t)=x10+x20t+12t2,0tts,\begin{aligned} x_2(t) &= x_{20}+t, \\ x_1(t) &= x_{10}+x_{20}t+\frac{1}{2}t^2, \qquad 0\leq t\leq t_s, \end{aligned}

followed by

x2(t)=x2s(tts),x1(t)=x1s+x2s(tts)12(tts)2.\begin{aligned} x_2(t) &= x_{2s}-(t-t_s), \\ x_1(t) &= x_{1s} + x_{2s}(t-t_s) - \frac{1}{2}(t-t_s)^2. \end{aligned}

Computing the Switching Time

The switching time is determined by enforcing the terminal conditions:

x1(tf)=0,x2(tf)=0.x_1(t_f)=0, \qquad x_2(t_f)=0.

For a specified initial condition, one selects the switching sequence consistent with the phase-plane region and solves the resulting algebraic equations for tst_s and tft_f.

An equivalent geometric procedure is:

  1. identify the constant-control parabola passing through the initial state;

  2. determine its intersection with the appropriate terminal switching curve;

  3. use that intersection as the switching point; and

  4. compute the travel time along both arcs.

Why Minimum-Time Problems Favor Extreme Controls

If the control enters the dynamics linearly and the cost penalizes only elapsed time, reducing the magnitude of the control generally delays arrival.

Pontryagin’s Minimum Principle formalizes this intuition. Since the Hamiltonian is linear in uu, minimizing it over a bounded interval selects one of the endpoints.

Thus,

u(t){1,+1}u^*(t)\in\{-1,+1\}

almost everywhere, except possibly at switching times or on singular arcs.

Higher-Order Integrator Systems

For the rrth-order integrator

x(r)=u,x^{(r)}=u,

the costate components become higher-degree polynomials in time.

Therefore, the switching function can possess more zeros, and the optimal control can switch more than once.

The double integrator is especially simple because its switching function is affine in time and therefore has at most one zero.

Singular Arcs

A singular arc occurs when the switching function vanishes over a nonzero interval:

σ(t)=Hu=0\sigma(t) = \frac{\partial H}{\partial u} = 0

for all tt in that interval.

On a singular arc, direct Hamiltonian minimization does not determine the control. One must differentiate the switching function until the control appears explicitly:

σ(t)=0,σ˙(t)=0,σ¨(t)=0,\sigma(t)=0, \quad \dot{\sigma}(t)=0, \quad \ddot{\sigma}(t)=0, \quad \ldots

The resulting conditions may produce a singular control law.

Singular arcs are common in:

One-Sided and Two-Sided Control

Mechanical systems often admit two-sided control:

umaxuumax.-u_{\max}\leq u\leq u_{\max}.

Examples include positive and negative torque, force, or acceleration.

Many process systems instead admit one-sided control:

0uumax.0\leq u\leq u_{\max}.

For example, material can be added to a reactor but may not be removable through the same control channel.

One-sided control can create asymmetric switching structures and often increases the likelihood of boundary and singular arcs.

Common Errors

  1. Claiming that a free final time always implies H=0H^*=0.

  2. Omitting the running-cost term 1 from a minimum-time Hamiltonian without explaining the adopted convention.

  3. Applying H/u=0\partial H/\partial u=0 to a Hamiltonian that is linear in a bounded control.

  4. Ignoring the admissible control interval in Hamiltonian minimization.

  5. Reversing the sign of the bang–bang law.

  6. Assuming that λ2=0\lambda_2=0 at an isolated switch implies a singular arc.

  7. Treating a switching curve as a state trajectory valid for every control.

  8. Forgetting continuity of the state at the switching time.

Summary

The main conclusions are:

  1. Along an optimal trajectory,

dHdt=Ht.\frac{\,\mathrm{d} H^*}{\,\mathrm{d} t} = \frac{\partial H}{\partial t}.
  1. If the Hamiltonian has no explicit time dependence, it is constant.

  2. If the final time is free and the endpoint terms have no explicit final-time dependence, then the constant Hamiltonian is zero.

  3. The minimum-time double integrator has a Hamiltonian linear in the bounded control.

  4. Stationarity does not determine the optimal control in this problem.

  5. Pontryagin’s Minimum Principle yields

u=sgn(λ2).u^*=-\operatorname{sgn}(\lambda_2).
  1. The switching function is affine in time and can cross zero at most once.

  2. The optimal control is bang–bang with at most one switch.

  3. Constant-control trajectories are parabolas in the phase plane.

  4. Singular arcs require separate higher-order analysis but do not occur in the standard minimum-time double integrator.

Connection. Before treating more delicate switching behavior, it is useful to unify the common Bolza, Mayer, and Lagrange formulations and clarify minimum-time conventions.