{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $x_1 \u003c x_2$ and $y_1 \u003c y_2$ be real numbers, let $R = [x_1, x_2] \\times [y_1, y_2]$, and let $f_{ij} \\in \\R$ be given values at the corners $(x_i, y_j)$ for $i, j \\in \\set{1, 2}$.\nThe *bilinear interpolant* is the unique function $p \\colon R \\to \\R$ of the form $p(x, y) = a + b x + c y + d x y$ with $p(x_i, y_j) = f_{ij}$ for all $i, j$.\nIn terms of $s = (x - x_1)/(x_2 - x_1)$ and $t = (y - y_1)/(y_2 - y_1)$, it is\n$$p(x, y) = (1 - s)(1 - t) f_{11} + s (1 - t) f_{21} + (1 - s) t f_{12} + s t f_{22}.$$\nFor data on a rectangular grid, *bilinear interpolation* uses this formula on each grid cell.\n\n## Remarks\n\nThe formula has the required form and takes the value $f_{ij}$ at each corner, which shows existence.\nUniqueness holds because a function $a + bx + cy + dxy$ vanishing at the four corners has $a = b = c = d = 0$, as one checks on the unit square.\nExample: for $f(x, y) = 2 + 3x - y + xy$, the bilinear interpolant on any rectangle is $f$ itself, since $f$ already has the required form.\nNon-example: $p(x, y) = x^2$ on the unit square has corner values $0, 1, 0, 1$, but it is not of the form $a + bx + cy + dxy$, so it is not the bilinear interpolant; that interpolant is $x$.\nThe interpolant is linear along every horizontal and vertical line, but not linear in general: along the diagonal $x = y$ of the unit square, $xy$ restricts to $x^2$.\nOn a grid, the cellwise interpolants agree on shared edges, so the result is continuous, but its gradient jumps across cell edges in general.\n\n## Explanations\n\n### L1 human\n\nBilinear interpolation fills in a rectangle from its four corner values by mixing them with weights given by the areas of the opposite sub-rectangles.\nIt is linear in each variable separately, which is where the name comes from.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "5QJYCNRYMQ",
    "kind": "definition",
    "msc": [
      "65D05",
      "41A05"
    ],
    "name": "Bilinear interpolation",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Bilinear_interpolation"
      }
    ],
    "tag": "ZVDW0BJ4FY",
    "uses": [
      "SS1YMS2NPC",
      "BM703GV34G"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/ZVDW0BJ4FY/",
  "links": [
    {
      "field": "defines",
      "target": "5QJYCNRYMQ"
    },
    {
      "field": "uses",
      "target": "SS1YMS2NPC"
    },
    {
      "field": "uses",
      "target": "BM703GV34G"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/ZVDW0BJ4FY.md",
  "msc": [
    "65D05",
    "41A05"
  ],
  "name": "Bilinear interpolation",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/ZVD/ZVDW0BJ4FY.md",
  "status": null,
  "tag": "ZVDW0BJ4FY",
  "uri": "m2://ZVDW0BJ4FY",
  "url": "https://tamnd.github.io/math2/wiki/bilinear-interpolation-definition/",
  "writing": {
    "tag": "ZVDW0BJ4FY",
    "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
      }
    ]
  }
}
