advanced34 min studyLesson 358 in Mathematics

Pontryagin’s maximum principle

Derive state–costate necessary conditions while keeping sign conventions, endpoint rules and normality explicit.

On this page

What you’ll understand

  • Write consistent state, adjoint and Hamiltonian-minimization equations.
  • Apply the correct transversality condition for a free terminal state.
  • Distinguish necessary extremal conditions from an independently verified global optimum.

An optimal input changes not only the immediate running cost but every future state reached through the dynamics. A costate records the marginal effect of those state changes on the remaining objective. Pontryagin’s principle couples the forward state equation to a backward adjoint equation and a pointwise control choice. Despite its historical name, one can write it using Hamiltonian minimization; the sign convention must remain consistent. The result supplies necessary conditions, not an automatic certificate that every resulting extremal is globally optimal.

Specify the problem before its multipliers

Use a fixed final time T, fixed initial state, no state constraints and a free terminal state. Minimize a smooth terminal cost φ(x(T)) plus the integral of L(t,x,u), subject to ẋ=f(t,x,u) and measurable inputs in a compact set U. Assume f and L continuous in their arguments and continuously differentiable in x, with their state derivatives continuous and bounded on compact state sets uniformly in t and u. Assume nearby admissible trajectories exist to T, so the state equation has unique absolutely continuous solutions and well-defined first variations there. Assume an optimum exists. Under these hypotheses, the free-endpoint maximum principle has a normal costate formulation.

Define H=L+pᵀf. The state follows H_p, the costate follows −H_x, and the chosen control minimizes H over U almost everywhere along the optimal state and costate. The terminal rule is p(T)=∇φ(x(T)). A convention H=pᵀf−L instead leads to maximization and a corresponding costate sign change. Mixing the minimizing Hamiltonian with the maximizing control rule gives the wrong command. A derivative condition H_u=0 applies only to an interior smooth minimizing control; constrained minimizers can lie on the boundary and require comparison over the whole allowed set.

H(t,x,u,p)=L(t,x,u)+p⊤f(t,x,u),x˙=Hp,p˙=−Hx,u∗(t)∈argmin⁡u∈UH(t,x∗,u,p)H(t,x,u,p)=L(t,x,u)+p^\top f(t,x,u),\quad\dot x=H_p,\quad\dot p=-H_x,\quad u_*(t)\in\operatorname*{argmin}_{u\in U}H(t,x_*,u,p)
This is the minimization sign convention for the normal fixed-time problem. The pointwise condition holds almost everywhere and respects the full allowed control set.↔ Scroll wide equations horizontally.

Endpoint constraints change the boundary conditions

The free terminal state permits arbitrary terminal state variations, which produces the gradient transversality rule. A fixed terminal state instead has no arbitrary terminal variation, so p(T)=∇φ is not the correct standalone rule. Terminal manifold constraints introduce endpoint multipliers or normal directions. A free terminal time adds another transversality relation involving the Hamiltonian and explicit time dependence. These are different problems, not interchangeable decorations on the same boundary-value system. State constraints can introduce still more complicated multiplier behavior and are outside the simple formulation above.

In a general constrained-endpoint formulation, write H=λ₀L+pᵀf with λ₀≥0 and a nontrivial multiplier pair. The normal case has λ₀>0 and can be scaled to one; an abnormal extremal has λ₀=0 and cannot be normalized that way. For the basic smooth free-terminal-state problem above, λ₀=0 would force p(T)=0 and then p identically zero by the adjoint equation, contradicting nontriviality. That is why normality is justified there. It should not be assumed automatically after adding endpoint constraints.

p(T)=∇ϕ(x∗(T))for a free terminal state,Hλ0=λ0L+p⊤f,λ0≥0p(T)=\nabla\phi(x_*(T))\quad\text{for a free terminal state},\qquad H_{\lambda_0}=\lambda_0L+p^\top f,\quad\lambda_0\ge0
The terminal gradient rule is tied to the stated free-endpoint normal problem. General endpoint constraints introduce additional multipliers and can admit abnormal extremals.↔ Scroll wide equations horizontally.

Necessary conditions guide a search, not its final verdict

The coupled equations usually form a two-point boundary-value problem: x is known at the initial time and p at the final time. Shooting methods guess missing initial costates, integrate forward and correct terminal residuals. Such methods can be sensitive because unstable directions magnify the guessed error. Finding one numerical root establishes only an extremal candidate unless a sufficient condition is also checked. Different extremals can have different costs, and a candidate can fail admissibility through a control bound or an unintended endpoint mismatch.

For convex examples, global optimality can sometimes be verified independently by a convexity inequality or direct lower bound. In more general nonlinear problems, second variations or a verified value function may distinguish an optimum from other extremals. Bang-bang controls arise when the minimizing Hamiltonian is affine in a bounded control and its coefficient does not vanish. A vanishing coefficient over an interval is a singular case requiring more analysis; it is not permission to assign an arbitrary command without checking dynamics and higher conditions.

A bounded command at a soft terminal target

Minimize 12∫01u2dt+12(x(1)−3)2\tfrac12\int_0^1u^2dt+\tfrac12(x(1)-3)^2 subject to ẋ=u, x(0)=0 and |u|≤1. Find and verify the optimum.

  1. The Hamiltonian is u²/2+pu, so ṗ=0 and u=clip(−p,−1,1). The terminal rule is p(1)=x(1)−3.

  2. A constant command u=1 gives x(1)=1 and p=−2. The Hamiltonian minimizer is indeed clip(2,−1,1)=1, so all necessary conditions match.

  3. For any admissible command let c=∫₀¹u dt∈[−1,1]. Cauchy–Schwarz gives ∫u²dt≥c², so the cost is at least c²/2+(c−3)²/2. Its derivative 2c−3 is negative on [−1,1], giving minimum 5/2 at c=1, attained by u≡1.

The result

The control u=1 is globally optimal with cost 5/2. The direct convex lower bound supplies the sufficiency proof that the necessary principle alone would not provide.

Explore the model

Interactive lab

Interactive lab · function

Minimize a quadratic Hamiltonian slice

Pause and Reset, then set a=0.5,x=1. Predict the derivative of u²/2 at u=1 is 1. For a costate p=−2, adding the linear term pu makes the Hamiltonian derivative there −1, so the constrained minimum over [−1,1] remains at the right endpoint. For a fresh comparison Reset and set a=0.5,x=−1 to inspect the other endpoint. The graph shows only the quadratic running term; the costate’s linear term must be added analytically.

Minimize a quadratic Hamiltonian sliceThis lab uses only y = ax². Playback traces the curve within the fixed integration interval from 0 to x; it does not estimate numerical error or change the chosen point. Current readings: y at chosen x: 0.608; Tangent slope · 2ax: 1.35; Signed area · ax³/3: 0.182. All parameters are adjustable with the labeled controls below.−2.4−1.201.22.4−9−4.504.59xy(x, ax²)
y = ax²TangentSigned integral
y at chosen x
0.608
Tangent slope · 2ax
1.35
Signed area · ax³/3
0.182
t = 0 s

This lab uses only y = ax². Playback traces the curve within the fixed integration interval from 0 to x; it does not estimate numerical error or change the chosen point. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forAn interior zero derivative is not required when the allowed control interval places the minimum at a boundary.

Check your understanding

For the normal minimizing convention H=L+pᵀf and a free terminal state, which condition is correct?

Try it yourself

With ẋ=u, x(0)=0, |u|≤1 and T=1, replace the terminal target 3 by 1/2 in the same half-weighted cost. Find the optimum and verify its cost.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

For an unsaturated constant control c, combine p=c−1/2 with c=−p. Then check the bound and use the same Cauchy–Schwarz lower bound.

Compare with the solution

The equations give c=−(c−1/2), hence c=1/4, which lies inside the allowed interval. The state is x(t)=t/4 and p=−1/4. Its cost is (1/2)(1/16)+(1/2)(−1/4)²=1/16. For any command with mean c, the cost is at least c²/2+(c−1/2)²/2, minimized at c=1/4. Equality in the integral bound holds for the constant command, proving global optimality separately from the necessary conditions.

Take it with you

  • Hamiltonian sign, control optimization and terminal costate signs must be consistent.
  • Normality and transversality depend on endpoint constraints.
  • An extremal needs a separate sufficiency argument before it is called a global optimum.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.