# Pontryagin's maximum principle

Pontryagin's maximum principle is used in optimal control theory to find the best possible control for taking a dynamical system from one state to another, especially in the presence of constraints for the state or input controls. It states that it is necessary for any optimal control along with the optimal state trajectory to solve the so-called Hamiltonian system, which is a two-point boundary value problem, plus a maximum condition of the control Hamiltonian. These necessary conditions become sufficient under certain convexity conditions on the objective and constraint functions.
The maximum principle was formulated in 1956 by the Russian mathematician Lev Pontryagin and his students, and its initial application was to the maximization of the terminal speed of a rocket. The result was derived using ideas from the classical calculus of variations. After a slight perturbation of the optimal control, one considers the first-order term of a Taylor expansion with respect to the perturbation; sending the perturbation to zero leads to a variational inequality from which the maximum principle follows.
Widely regarded as a milestone in optimal control theory, the significance of the maximum principle lies in the fact that maximizing the Hamiltonian is much easier than the original infinite-dimensional control problem; rather than maximizing over a function space, the problem is converted to a pointwise optimization. A similar logic leads to Bellman's principle of optimality, a related approach to optimal control problems which states that the optimal trajectory remains optimal at intermediate points in time. The resulting Hamilton–Jacobi–Bellman equation provides a necessary and sufficient condition for an optimum, and admits a straightforward extension to stochastic optimal control problems, whereas the maximum principle does not. However, in contrast to the Hamilton–Jacobi–Bellman equation, which needs to hold over the entire state space to be valid, Pontryagin's Maximum Principle is potentially more computationally efficient in that the conditions which it specifies only need to hold over a particular trajectory.

## Notation

For set ${\mathcal {U}}$ and functions
    $\Psi :\mathbb {R} ^{n}\to \mathbb {R}$,
    $H:\mathbb {R} ^{n}\times {\mathcal {U}}\times \mathbb {R} ^{n}\times \mathbb {R} \to \mathbb {R}$,
    $L:\mathbb {R} ^{n}\times {\mathcal {U}}\to \mathbb {R}$,
    $f:\mathbb {R} ^{n}\times {\mathcal {U}}\to \mathbb {R} ^{n}$,
we use the following notation:
    $\Psi _{T}(x(T))=\left.{\frac {\partial \Psi (x)}{\partial T}}\right|_{x=x(T)}\,$,
    $\Psi _{x}(x(T))={\begin{bmatrix}\left.{\frac {\partial \Psi (x)}{\partial x_{1}}}\right|_{x=x(T)}&\cdots &\left.{\frac {\partial \Psi (x)}{\partial x_{n}}}\right|_{x=x(T)}\end{bmatrix}}$,
    $H_{x}(x^{*},u^{*},\lambda ^{*},t)={\begin{bmatrix}\left.{\frac {\partial H}{\partial x_{1}}}\right|_{x=x^{*},u=u^{*},\lambda =\lambda ^{*}}&\cdots &\left.{\frac {\partial H}{\partial x_{n}}}\right|_{x=x^{*},u=u^{*},\lambda =\lambda ^{*}}\end{bmatrix}}$,
    $L_{x}(x^{*},u^{*})={\begin{bmatrix}\left.{\frac {\partial L}{\partial x_{1}}}\right|_{x=x^{*},u=u^{*}}&\cdots &\left.{\frac {\partial L}{\partial x_{n}}}\right|_{x=x^{*},u=u^{*}}\end{bmatrix}}$,
    $f_{x}(x^{*},u^{*})={\begin{bmatrix}\left.{\frac {\partial f_{1}}{\partial x_{1}}}\right|_{x=x^{*},u=u^{*}}&\cdots &\left.{\frac {\partial f_{1}}{\partial x_{n}}}\right|_{x=x^{*},u=u^{*}}\\\vdots &\ddots &\vdots \\\left.{\frac {\partial f_{n}}{\partial x_{1}}}\right|_{x=x^{*},u=u^{*}}&\ldots &\left.{\frac {\partial f_{n}}{\partial x_{n}}}\right|_{x=x^{*},u=u^{*}}\end{bmatrix}}$.

## Formal statement of necessary conditions for minimization problems

Here the necessary conditions are shown for minimization of a functional.
Consider an n-dimensional dynamical system, with state variable $x\in \mathbb {R} ^{n}$, and control variable $u\in {\mathcal {U}}$, where ${\mathcal {U}}$ is the set of admissible controls. The evolution of the system is determined by the state and the control, according to the differential equation ${\dot {x}}=f(x,u)$. Let the system's initial state be $x_{0}$ and let the system's evolution be controlled over the time-period with values $t\in [0,T]$. The latter is determined by the following differential equation:
    ${\dot {x}}=f(x,u),\quad x(0)=x_{0},\quad u(t)\in {\mathcal {U}},\quad t\in [0,T]$
The control trajectory $u:[0,T]\to {\mathcal {U}}$ is to be chosen according to an objective. The objective is a functional $J$ defined by
    $J=\Psi (x(T))+\int _{0}^{T}L{\bigx(t),u(t){\big )}\,dt$,
where $L(x,u)$ can be interpreted as the rate of cost for exerting control $u$ in state $x$, and $\Psi (x)$ can be interpreted as the cost for ending up at state $x$. The specific choice of $L,\Psi$ depends on the application.
The constraints on the system dynamics can be adjoined to the Lagrangian $L$ by introducing time-varying Lagrange multiplier vector $\lambda$, whose elements are called the costates of the system. This motivates the construction of the Hamiltonian $H$ defined for all $t\in [0,T]$ by:
    $H{\bigx(t),u(t),\lambda (t),t{\big )}=\lambda ^{\rm {T}}(t)\cdot f{\bigx(t),u(t){\big )}+L{\bigx(t),u(t){\big )}$
where $\lambda ^{\rm {T}}$ is the transpose of $\lambda$.
Pontryagin's minimum principle states that the optimal state trajectory $x^{*}$, optimal control $u^{*}$, and corresponding Lagrange multiplier vector $\lambda ^{*}$ must minimize the Hamiltonian $H$ so that
| $H{\bigx^{*}(t),u^{*}(t),\lambda ^{*}(t),t{\big )}\leq H{\bigx(t),u,\lambda (t),t{\big )}$ | (1) |
for all time $t\in [0,T]$ and for all permissible control inputs $u\in {\mathcal {U}}$. Here, the trajectory of the Lagrangian multiplier vector $\lambda$ is the solution to the costate equation and its terminal conditions:
| $-{\dot {\lambda }}^{\rm {T}}(t)=H_{x}{\bigx^{*}(t),u^{*}(t),\lambda (t),t{\big )}=\lambda ^{\rm {T}}(t)\cdot f_{x}{\bigx^{*}(t),u^{*}(t){\big )}+L_{x}{\bigx^{*}(t),u^{*}(t){\big )}$ | (2) |
| $\lambda ^{\rm {T}}(T)=\Psi _{x}(x(T))$ | (3) |
If $x(T)$ is fixed, then these three conditions in (1)-(3) are the necessary conditions for an optimal control.
If the final state $x(T)$ is not fixed (i.e., its differential variation is not zero), there is an additional condition
| $\Psi _{T}(x(T))+H(T)=0$ | (4) |
These four conditions in (1)-(4) are the necessary conditions for an optimal control.