{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $U \\subseteq \\R^m$ be nonempty, $T \u003e 0$, and let $f \\colon [0, T] \\times \\R^n \\times U \\to \\R^n$ and $L \\colon [0, T] \\times \\R^n \\times U \\to \\R$ be continuous with continuous partial derivatives in $x$.\nLet $H(t, x, u, p, \\lambda_0) = p \\cdot f(t, x, u) - \\lambda_0 L(t, x, u)$ be the [[Hamiltonian|RACVWG5QTK]], and fix $\\lambda_0 \\ge 0$.\nLet $u \\colon [0, T] \\to U$ be a measurable bounded control with trajectory $x$ of the [[control system|ZPDTVZQN5K]] $x' = f(t, x, u)$.\nThe *costate equation* along $(x, u)$ is the linear differential equation\n$$p'(t) = -\\frac{\\partial H}{\\partial x}(t, x(t), u(t), p(t), \\lambda_0) = -\\Big(\\frac{\\partial f}{\\partial x}(t, x(t), u(t))\\Big)^{T} p(t) + \\lambda_0 \\nabla_x L(t, x(t), u(t))$$\nfor an [[absolutely continuous|ZT6F4C2YHK]] function $p \\colon [0, T] \\to \\R^n$, required to hold for almost every $t \\in [0, T]$.\nA solution $p$ is a *costate* or *adjoint* vector along $(x, u)$.\n\n## Remarks\n\nExample: $x' = u$ in $\\R$ with running cost $\\int \\frac12 (x^2 + u^2) \\, dt$ and $\\lambda_0 = 1$.\nThen $H = p u - \\frac12 (x^2 + u^2)$ and $\\partial H / \\partial x = -x$, so the costate equation is $p' = x$.\nNon-example: $p' = +\\partial H / \\partial x$ is not the costate equation, because the sign is wrong.\nWith it, the quantity $p \\cdot \\delta x$ for a solution $\\delta x$ of the linearized equation $\\delta x' = (\\partial f / \\partial x) \\delta x$ would not be constant when $\\lambda_0 = 0$.\nThe costate equation is fixed by a boundary condition, the transversality condition.\nFor a free final state and an endpoint cost $\\varphi(x(T))$ to be minimized, it is $p(T) = -\\lambda_0 \\nabla \\varphi(x(T))$.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "WS9MRAZMFW",
    "kind": "definition",
    "msc": [
      "49K15",
      "93C15"
    ],
    "name": "Costate equation",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Costate_equation"
      }
    ],
    "tag": "SVXBKKB3T4",
    "uses": [
      "RACVWG5QTK",
      "ZPDTVZQN5K",
      "ZT6F4C2YHK"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/SVXBKKB3T4/",
  "links": [
    {
      "field": "defines",
      "target": "WS9MRAZMFW"
    },
    {
      "field": "uses",
      "target": "RACVWG5QTK"
    },
    {
      "field": "uses",
      "target": "ZPDTVZQN5K"
    },
    {
      "field": "uses",
      "target": "ZT6F4C2YHK"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/SVXBKKB3T4.md",
  "msc": [
    "49K15",
    "93C15"
  ],
  "name": "Costate equation",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/SVX/SVXBKKB3T4.md",
  "status": null,
  "tag": "SVXBKKB3T4",
  "uri": "m2://SVXBKKB3T4",
  "url": "https://tamnd.github.io/math2/wiki/costate-equation-definition/",
  "writing": {
    "tag": "SVXBKKB3T4",
    "kind": "definition",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      },
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
