{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $K$ be a [[field|0QA8CHH8MG]], let $n \\ge 0$, let $x_0, \\dots, x_n \\in K$ be pairwise distinct, and let $y_0, \\dots, y_n \\in K$.\nFor $j = 0, \\dots, n$, the Lagrange basis polynomial is\n$$\\ell_j(x) = \\prod_{k \\ne j} \\frac{x - x_k}{x_j - x_k} \\in K[x].$$\nThe Lagrange interpolation polynomial of the data is\n$$L(x) = \\sum_{j=0}^{n} y_j \\, \\ell_j(x).$$\n\n## Remarks\n\nEach $\\ell_j$ has degree $n$, with $\\ell_j(x_j) = 1$ and $\\ell_j(x_k) = 0$ for $k \\ne j$.\nSo $L$ has degree at most $n$ and $L(x_i) = y_i$ for all $i$: it is the unique [[interpolation polynomial|SS1YMS2NPC]] of the data.\nExample: for the data $(0, 1)$, $(1, 3)$, $(2, 7)$, the basis polynomials are $\\ell_0 = \\frac{(x-1)(x-2)}{2}$, $\\ell_1 = -x(x-2)$ and $\\ell_2 = \\frac{x(x-1)}{2}$.\nThen $L = \\ell_0 + 3 \\ell_1 + 7 \\ell_2 = x^2 + x + 1$, and indeed $L(0) = 1$, $L(1) = 3$, $L(2) = 7$.\nNon-example: if two nodes coincide, $x_j = x_k$ with $j \\ne k$, the denominator $x_j - x_k$ is $0$ and the formula has no meaning.\n\n## Explanations\n\n### L1 human\n\nEach basis polynomial is a switch that is on at one node and off at all others.\nWeighting the switches by the wanted values gives a polynomial through all the points.\n",
  "commit": "547b6eddb8f2feb8d579f2d633d22a27b7e132fc",
  "front": {
    "defines": "237KR6FRCK",
    "kind": "definition",
    "msc": [
      "41A05",
      "65D05"
    ],
    "name": "Lagrange interpolation",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Lagrange_polynomial"
      }
    ],
    "tag": "QGQTYT6YZR",
    "uses": [
      "0QA8CHH8MG",
      "0Q9EZS90GY",
      "SS1YMS2NPC"
    ]
  },
  "kind": "definition",
  "link": "https://math2.tamnd.com/node/QGQTYT6YZR/",
  "links": [
    {
      "field": "defines",
      "target": "237KR6FRCK"
    },
    {
      "field": "uses",
      "target": "0QA8CHH8MG"
    },
    {
      "field": "uses",
      "target": "0Q9EZS90GY"
    },
    {
      "field": "uses",
      "target": "SS1YMS2NPC"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/QGQTYT6YZR.md",
  "msc": [
    "41A05",
    "65D05"
  ],
  "name": "Lagrange interpolation",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/QGQ/QGQTYT6YZR.md",
  "status": null,
  "tag": "QGQTYT6YZR",
  "uri": "m2://QGQTYT6YZR",
  "url": "https://math2.tamnd.com/wiki/lagrange-interpolation-definition/",
  "writing": {
    "tag": "QGQTYT6YZR",
    "kind": "definition",
    "level": "W0",
    "next": [
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
