The Hamiltonian is a function used to solve a problem of optimal control for a dynamical system. It can be understood as an instantaneous increment of the Lagrangian expression of the problem that is to be optimized over a certain time period. Inspired by, but distinct from, the Hamiltonian of classical mechanics, the Hamiltonian of optimal control theory was developed by Lev Pontryagin as part of his maximum principle. Pontryagin proved that a necessary condition for solving the optimal control problem is that the control should be chosen so as to optimize the Hamiltonian. Problem statement and definition of the Hamiltonian Consider a dynamical system of first-order differential equations where denotes a vector of state variables, and a vector of control variables. Once initial conditions and controls are specified, a solution to the differential equations, called a trajectory , can be found. The problem of optimal control is to choose (from some set ) so that maximizes or minimizes a certain objective function between an initial time and a terminal time (where may be infinity). Specifically, the goal is to optimize a performance index at each point in time, subject to the above equations of motion of the state variables. The solution method involves defining an ancillary function known as the control Hamiltonian which combines the objective function and the state equations much like a Lagrangian in a static optimization problem, only that the multipliers , referred to as costate variables, are functions of time rather than constants. The goal is to find an optimal control policy function and, with it, an optimal trajectory of the state variable , which by Pontryagin's maximum principle are the arguments that maximize the Hamiltonian, for all The first-order necessary conditions for a maximum are given by which is the maximum principle, which generates the state transition function , which generates the latter of which are referred to as the costate equations. Together, the state and costate equations describe the Hamiltonian dynamical system (again analogous to but distinct from the Hamiltonian system in physics), the solution of which involves a two-point boundary value problem, given that there are boundary conditions involving two different points in time, the initial time (the differential equations for the state variables), and the terminal time (the differential equations for the costate variables; unless a final function is specified, the boundary conditions are , or for infinite time horizons). A