advanced34 min studyLesson 359 in Mathematics

Hamilton–Jacobi–Bellman equations

Turn remaining optimal cost into a feedback equation and verify a policy by integrating a pointwise inequality.

On this page

What you’ll understand

  • Derive the finite-horizon HJB equation from the principle of optimality.
  • Verify a smooth candidate value function and an admissible minimizing feedback.
  • Explain why nonsmooth value functions require more than a classical derivative equation.

A costate follows one candidate trajectory. A value function describes the best remaining cost from every state and time. Dynamic programming connects these viewpoints by insisting that the first short decision and the best continuation form one optimal problem. If the value function is smooth, that consistency becomes the Hamilton–Jacobi–Bellman equation. Its verification argument is unusually useful: a pointwise inequality can certify a global lower bound for every admissible policy, while a policy attaining equality proves the bound achievable. Smoothness and admissibility are essential parts of that argument.

The remaining problem is part of the same problem

For fixed final time T, let V(t,x) be the infimum of terminal cost plus accumulated running cost from state x at time t. Assume deterministic dynamics ẋ=f(s,x,u), known state, admissible measurable controls and trajectories existing over the full remaining interval. The principle of optimality says that splitting the interval at t+h leaves an initial short running cost plus V(t+h,x(t+h)), then takes the infimum over the first control segment. It does not assume an open-loop command chosen now remains appropriate after an unmodeled disturbance.

For a continuously differentiable V and sufficiently regular f and L, expand this identity over a short interval and divide by h. The result is V_t plus the infimum of L+∇Vᵀf equal to zero, with terminal condition V(T,x)=φ(x). Compact control sets and continuity give a minimum; for unbounded controls one must verify attainment separately, as coercive quadratic control costs do in the worked example. The equation is nonlinear through optimization over u even when the original state dynamics is linear.

Vt(t,x)+inf⁡u∈U{L(t,x,u)+∇xV(t,x)⊤f(t,x,u)}=0,V(T,x)=ϕ(x)V_t(t,x)+\inf_{u\in U}\{L(t,x,u)+\nabla_xV(t,x)^\top f(t,x,u)\}=0,\qquad V(T,x)=\phi(x)
This classical finite-horizon equation presumes differentiability of the value function. An infimum need not have an attaining control without extra conditions.↔ Scroll wide equations horizontally.

A verification proof gives both a bound and a policy

Suppose a continuously differentiable candidate W satisfies this equation and the terminal condition on a domain containing every relevant admissible trajectory. Along any admissible control, the chain rule gives dW/dt+L≥0, because that control’s Hamiltonian cannot be below the infimum. Integrating yields total cost at least W at the initial pair. This proves a global lower bound, without assuming that the chosen trajectory itself satisfies Pontryagin’s necessary conditions. The differentiability and integrability hypotheses justify the chain rule and time integration rather than merely formal algebra.

If a measurable feedback attains the infimum everywhere along its resulting trajectory, and that trajectory exists to T and satisfies all constraints, the inequality becomes equality. The feedback then achieves the lower bound and W is the value there. A minimizing expression that produces a nonexistent, exploding or inadmissible trajectory is not a verification. This distinction matters near state constraints or discontinuous feedback boundaries. An algebraic minimizer of the Hamiltonian is only one ingredient; its induced closed-loop behavior must still be checked.

ddtW(t,x(t))+L(t,x(t),u(t))≥0⟹Jt,x(u)≥W(t,x)\frac{d}{dt}W(t,x(t))+L(t,x(t),u(t))\ge0\quad\Longrightarrow\quad J_{t,x}(u)\ge W(t,x)
Terminal equality W(T,·)=φ turns the integrated inequality into a cost lower bound. An admissible selector achieving equality certifies optimality.↔ Scroll wide equations horizontally.

Nonsmoothness is information, not a numerical accident

Optimal costs can develop corners when different strategies exchange preference or when the target is reached from opposite directions. A minimum-time integrator with bounded speed has value proportional to absolute distance, which is not differentiable at the target. Demanding a classical derivative there would wrongly reject the correct value. Viscosity solutions replace unavailable derivatives by smooth test functions touching from appropriate sides. Their comparison theory can provide uniqueness under suitable continuity, growth and boundary assumptions; no unrestricted uniqueness theorem for arbitrary nonlinear control problems is being claimed here.

Where V is smooth, its state gradient often equals the normal costate along an optimal trajectory, connecting HJB feedback with Pontryagin’s principle. But a solution of one characteristic trajectory does not determine V globally; characteristics can cross and the value can remain nonsmooth. Numerically, solving a state-space HJB equation suffers dimensional growth, whereas trajectory methods avoid a full grid but provide less global information. Approximate learned value functions must be checked for residuals, boundary behavior and policy admissibility before their attractive plots are treated as certificates.

Verify a finite-horizon integrator policy

For ẋ=u on [0,1], x(0)=1 and unrestricted real u, minimize ∫₀¹u²dt+4x(1)². Verify the value and feedback by HJB.

  1. Set W(t,x)=P(t)x². Minimizing u²+2Pxu gives u=−Px and requires Ṗ=P² with P(1)=4. Thus P(t)=4/(1+4(1−t)).

  2. The feedback trajectory is x(t)=(5−4t)/5, with constant command u=−4/5 and terminal state 1/5. It exists over the whole interval and is admissible.

  3. The actual cost is 16/25+4/25=4/5, matching W(0,1)=4/5. Moreover W_t+u²+W_xu=(u+Px)²≥0 for every input, so integration proves no other admissible input has lower cost.

The result

The feedback attains a global HJB lower bound. The final state is nonzero because the problem trades terminal error against effort rather than imposing a hard terminal equality.

Explore the model

Interactive lab

Interactive lab · function

Inspect the value-function gradient

Pause and Reset, then set a=0.8,x=1. Predict W=0.8 and gradient 1.6, giving the integrator command u=−gradient/2=−0.8 at the start of the example. For a fresh comparison Reset and set a=0.8,x=−1; predict the opposite command +0.8 with the same cost. The coefficient is a frozen time slice, not a numerical HJB solution over state and time.

Inspect the value-function gradientThis 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 forA value gradient converts a local state displacement into the marginal cost that determines feedback.

Check your understanding

What extra check turns an HJB pointwise minimizing control formula into a verified optimal policy?

Try it yourself

For ẋ=u with |u|≤2, find the minimum time to reach zero from x=3. Check the stationary HJB equation away from zero and explain the target boundary.

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

Give me a hint

Speed bounds give a time lower bound. A constant maximum-magnitude command toward the target can attain it.

Compare with the solution

Any control needs at least |x|/2 time because displacement magnitude is bounded by twice elapsed time. The command u=−2 sign(x) reaches zero in that time, so V(x)=|x|/2 and V(3)=3/2. For x≠0, V_x=sign(x)/2 and 1+min_{|u|≤2}V_xu=1−1=0. At zero impose the target boundary V(0)=0 and stop; there is no need to invent a classical derivative at its corner or continue accruing running time after arrival.

Take it with you

  • Dynamic programming describes optimal continuation from every relevant state and time.
  • A smooth HJB solution gives a lower bound; an admissible equality policy verifies optimality.
  • Correct value functions may be nonsmooth, requiring viscosity or other generalized analysis.

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.