{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $p$ be a prime, let $n \\ge 1$, and let $f \\in \\F_p[x]$ be a monic [[irreducible polynomial|00X2A9G9W3]] of [[degree|0DPF6WRZW6]] $n$.\nThe [[quotient ring|0VFW4Y69BT]] $\\F_p[x]/(f)$ of the [[polynomial ring|0Q9EZS90GY]] is a [[finite field|08RTDHX1SK]] with $p^n$ elements.\n*Finite field arithmetic* in this representation computes with the polynomials $a(x)$ of degree less than $n$ over $\\F_p$, one for each element, as follows.\n\n1. The sum $a + b$ is the coefficientwise sum modulo $p$.\n2. The product $a \\cdot b$ is the remainder of the polynomial product $a(x) b(x)$ under [[division|D6D0SR1FK3]] by $f$.\n3. The inverse of $a \\ne 0$ is the polynomial $u$ of degree less than $n$ with $u a + v f = 1$ for some $v \\in \\F_p[x]$, found by the extended [[Euclidean algorithm|0TRNT4X7J0]].\n\n## Remarks\n\nTake $p = 2$ and $f = x^3 + x + 1$, which has no root in $\\F_2$ and so is irreducible.\nThen $(x^2 + 1)(x + 1) = x^3 + x^2 + x + 1$, and its remainder modulo $f$ is $x^2$.\nThe inverse of $x$ is $x^2 + 1$, since $x(x^2 + 1) = x^3 + x = f + 1$.\nThe polynomial $x^2 + 1$ over $\\F_2$ cannot serve as $f$, since $x^2 + 1 = (x + 1)^2$, and then $x + 1$ has no inverse.\nOver $\\F_2$, an element is stored as the bit string of its coefficients, and addition is the bitwise exclusive or.\nThe inverse can also be computed as $a^{p^n - 2}$, since $a^{p^n - 1} = 1$ for $a \\ne 0$.\n",
  "commit": "547b6eddb8f2feb8d579f2d633d22a27b7e132fc",
  "front": {
    "defines": "YG3HWE6GEX",
    "kind": "definition",
    "msc": [
      "12E20",
      "11T71",
      "12-08"
    ],
    "name": "Finite field arithmetic",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Finite_field_arithmetic"
      }
    ],
    "tag": "92JCZQZSST",
    "uses": [
      "08RTDHX1SK",
      "00X2A9G9W3",
      "0Q9EZS90GY",
      "0VFW4Y69BT",
      "0DPF6WRZW6",
      "D6D0SR1FK3",
      "0TRNT4X7J0"
    ]
  },
  "kind": "definition",
  "link": "https://math2.tamnd.com/node/92JCZQZSST/",
  "links": [
    {
      "field": "defines",
      "target": "YG3HWE6GEX"
    },
    {
      "field": "uses",
      "target": "08RTDHX1SK"
    },
    {
      "field": "uses",
      "target": "00X2A9G9W3"
    },
    {
      "field": "uses",
      "target": "0Q9EZS90GY"
    },
    {
      "field": "uses",
      "target": "0VFW4Y69BT"
    },
    {
      "field": "uses",
      "target": "0DPF6WRZW6"
    },
    {
      "field": "uses",
      "target": "D6D0SR1FK3"
    },
    {
      "field": "uses",
      "target": "0TRNT4X7J0"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/92JCZQZSST.md",
  "msc": [
    "12E20",
    "11T71",
    "12-08"
  ],
  "name": "Finite field arithmetic",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/92J/92JCZQZSST.md",
  "status": null,
  "tag": "92JCZQZSST",
  "uri": "m2://92JCZQZSST",
  "url": "https://math2.tamnd.com/wiki/finite-field-arithmetic-definition/",
  "writing": {
    "tag": "92JCZQZSST",
    "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
      }
    ]
  }
}
