Adjoints and the Discrete-Time Pontryagin Principle
Finite-horizon optimal control produces a structured nonlinear program and the
KKT conditions characterize its local solutions. How do those multipliers
organize themselves when the equality constraints are a forward dynamical
recursion?
If we take the Bolza formulation of the DOCP and apply the KKT conditions directly, we obtain an optimization system with many multipliers and constraints. Written in raw form, it looks like any other nonlinear program. But in control, this structure has a long history and a name of its own: the Pontryagin principle. In fact, the discrete-time version can be seen as the structured KKT system that results from introducing multipliers for the dynamics and collecting terms stage by stage.
How do state feasibility, costate recursion, control stationarity, and
complementarity emerge from the stagewise Lagrangian?
Taking first-order variations and collecting terms gives the discrete-time adjoint system, control stationarity, and complementarity. At a local minimum {xt⋆,ut⋆} with multipliers {λt⋆,μt⋆,ν⋆}:
where NUt(⋅) is the normal cone to Ut. For simple box bounds, this reduces to standard KKT sign and complementarity conditions on the components of ut⋆.
Path-constraint multipliers (primal/dual feasibility and complementarity)
gt(xt⋆,ut⋆)≤0,μt⋆≥0,μt,i⋆gt,i(xt⋆,ut⋆)=0for all i,t.
The triplet “forward state, backward costate, control stationarity” is the discrete-time Euler–Lagrange system tailored to control with dynamics. It is the same KKT logic as before, but organized stagewise through the Hamiltonian.
Recap. The discrete-time Pontryagin principle is the KKT system for trajectory optimization, organized to exploit temporal structure. It has a forward-backward decomposition: states propagate forward through the dynamics, while costates propagate backward through the adjoint equation. The Hamiltonian Ht packages together the stage cost, the dynamics (weighted by the next costate), and any path constraints (weighted by their multipliers). Control stationarity says that optimal controls minimize the Hamiltonian at each stage. Complementarity ensures that only binding constraints carry nonzero multipliers. This structure underlies both analytical solution methods (such as LQR) and numerical algorithms (such as the adjoint method for gradient computation).
The costate equations characterize stationarity, but can the same backward
recursion compute every control derivative with one reverse sweep?
Optimization needs sensitivities. In trajectory problems we adjust decisions (controls or parameters) to reduce an objective while respecting dynamics and constraints. First‑order methods in the unconstrained case (e.g., gradient descent, L‑BFGS, Adam) require the gradient of the objective with respect to all controls, and constrained methods (SQP, interior‑point) require gradients of the Lagrangian, i.e., of costs and constraints. The discrete‑time adjoint equations provide these derivatives in a way that scales to long horizons and many decision variables.
This reverse accumulation produces every control gradient with one forward
rollout and one backward adjoint pass. The costate
λt measures the marginal effect of perturbing the state
at time t on the total objective. Each control gradient combines a direct
contribution from ct with an indirect contribution through the next state.
Backpropagation through an unrolled dynamical system performs the same
calculation.
Finite differences instead perturb one decision at a time and rerun the
system. They require on the order of p rollouts for p=(T−1)m control
variables and introduce a finite-difference step size. Forward-mode
sensitivities propagate a separate Jacobian-vector product for each parameter
direction, so their work also scales with p. Reverse mode propagates one
costate vector backward and reads all partial derivatives from that sweep. For
a scalar objective, this replaces one rollout per parameter by one
forward-backward pass, at the cost of storing or checkpointing the state
trajectory.
The adjoint recursion is therefore the reverse-mode derivative of the
trajectory objective. States carry the nominal trajectory forward, costates
carry its sensitivity backward, and the local control derivatives combine the
two at each stage.
The KKT conditions organize local optimality into primal feasibility,
stationarity, dual feasibility, and complementarity. Applied along a trajectory,
they give the discrete-time Pontryagin principle. States propagate forward,
costates propagate backward, and the Hamiltonian supplies the local control
stationarity condition. The same backward recursion computes all control
gradients with one reverse pass.
The necessary conditions do not choose how states and actions should be exposed
to a numerical solver. Should the states remain decision variables, be
eliminated by forward simulation, or appear only at segment boundaries?
Numerical trajectory optimization
compares those formulations.
By definition, Vt(xt) is the minimum future cost starting from xt. At the optimal trajectory, the envelope theorem gives ∇xtVt=λt, the marginal value of the state. Economically, λt measures how much the optimal cost would decrease if we could perturb the state xt by a small amount—it is the “shadow price” of the state at time t.
Control gradients: ∇utJ=λt+1, so ∇uJ=[λ2,λ3,λ4]=[0.0625,0.125,1.0].
Finite differences should match. The adjoint is O(T) work regardless of the number of controls; finite differences require O(T⋅m) rollouts for m-dimensional control.