{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Statement\n\nLet $K$ be a field and let $m \\ge 1$.\nLet $A(0), A(1), \\dots$ be [[invertible|0EB9N0S33C]] $m \\times m$ matrices over $K$, and let $b(0), b(1), \\dots$ be vectors in $K^m$.\nLet $\\Phi(0)$ be an invertible $m \\times m$ matrix and let $\\Phi(n+1) = A(n)\\, \\Phi(n)$ for $n \\ge 0$.\nThen each $\\Phi(n)$ is invertible, and for each $x(0) \\in K^m$ the solution of the [[matrix difference equation|9VA6P5KQQT]]\n$$x(n+1) = A(n)\\, x(n) + b(n) \\qquad (n \\ge 0)$$\nis\n$$x(n) = \\Phi(n)\\, \\Phi(0)^{-1} x(0) + \\sum_{k=0}^{n-1} \\Phi(n)\\, \\Phi(k+1)^{-1} b(k) \\qquad (n \\ge 0).$$\n\n## Remarks\n\nThe idea is to replace the constant vector $c$ in the homogeneous solution $\\Phi(n) c$ by a varying vector $c(n)$.\nPutting $x(n) = \\Phi(n) c(n)$ into the equation gives $\\Phi(n+1) c(n+1) = \\Phi(n+1) c(n) + b(n)$, so $c(n+1) = c(n) + \\Phi(n+1)^{-1} b(n)$.\nSumming this telescoping relation from $0$ to $n - 1$ gives the formula.\nExample: for $m = 1$ and a constant $A(n) = a \\ne 0$, take $\\Phi(n) = a^n$; the formula reads $x(n) = a^n x(0) + \\sum_{k=0}^{n-1} a^{n-1-k} b(k)$.\nInvertibility of the $A(n)$ is used to invert $\\Phi(k+1)$.\nWithout it, the formula still holds if $\\Phi(n)\\, \\Phi(0)^{-1}$ is replaced by the product $A(n-1) \\cdots A(0)$.\nLikewise $\\Phi(n)\\, \\Phi(k+1)^{-1}$ is replaced by $A(n-1) \\cdots A(k+1)$, which is the identity matrix when $k = n - 1$.\nA scalar recurrence of order $m$ becomes such a system for the vector $(u_n, \\dots, u_{n+m-1})$.\nFor $u_{n+2} + p_n u_{n+1} + q_n u_n = g_n$ with $q_n \\ne 0$ and two independent homogeneous solutions $y_1, y_2$, this gives the particular solution with $u_0 = u_1 = 0$:\n$$u_n = \\sum_{k=0}^{n-1} g_k\\, \\frac{y_1(k+1)\\, y_2(n) - y_1(n)\\, y_2(k+1)}{C(k+1)},$$\nwhere $C(j) = y_1(j) y_2(j+1) - y_2(j) y_1(j+1)$ is the Casoratian, which never vanishes.\n\n## Explanations\n\n### L1 human\n\nThe homogeneous equation is easy once you know a fundamental matrix: its solutions are $\\Phi(n) c$ for constant vectors $c$.\nTo handle the extra input $b(n)$, let the constant $c$ change with $n$.\nEach input $b(k)$ is then carried forward from time $k+1$ to time $n$ by the homogeneous dynamics, and the output is the sum of all these contributions.\n\n### L2 human\n\nThis is the discrete form of the [[variation of parameters|0Y6TH5PQVS]] method for linear differential equations, where the sum becomes an integral.\nIt is also the discrete Duhamel principle: the response to the inputs is a sum of free responses started at each time.\nWith constant $A$, it reads $x(n) = A^n x(0) + \\sum_{k=0}^{n-1} A^{n-1-k} b(k)$, which is the standard formula for linear time-invariant systems in discrete time.\nTogether with [[superposition|7W7VV861JW]], it describes all solutions of an inhomogeneous linear recurrence.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "about": [
      "9VA6P5KQQT"
    ],
    "kind": "statement",
    "msc": [
      "39A06"
    ],
    "name": "Variation of parameters for difference equations",
    "role": "theorem",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Variation_of_parameters"
      }
    ],
    "tag": "QQFYC988SJ",
    "uses": [
      "9VA6P5KQQT",
      "0EB9N0S33C",
      "0VD9ZSWWJG"
    ]
  },
  "kind": "statement",
  "link": "https://tamnd.github.io/math2/node/QQFYC988SJ/",
  "links": [
    {
      "field": "about",
      "target": "9VA6P5KQQT"
    },
    {
      "field": "uses",
      "target": "9VA6P5KQQT"
    },
    {
      "field": "uses",
      "target": "0EB9N0S33C"
    },
    {
      "field": "uses",
      "target": "0VD9ZSWWJG"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/QQFYC988SJ.md",
  "msc": [
    "39A06"
  ],
  "name": "Variation of parameters for difference equations",
  "prov": null,
  "role": "theorem",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/QQF/QQFYC988SJ.md",
  "status": null,
  "tag": "QQFYC988SJ",
  "uri": "m2://QQFYC988SJ",
  "url": "https://tamnd.github.io/math2/wiki/variation-of-parameters-for-difference-equations/",
  "writing": {
    "tag": "QQFYC988SJ",
    "kind": "statement",
    "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
      }
    ]
  }
}
