{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Proof\n\n1. Let $n$ be a positive integer and let $a$ be an integer. Let $d = \\gcd(a, n)$ be their [[greatest common divisor|02WF878BH1]].\n2. Since $n \\ne 0$, the integers $a$ and $n$ are not both $0$. So $d$ is a positive common divisor of $a$ and $n$.\n3. First assume that $a$ and $n$ are [[coprime|0GFKP8F8AG]], so $d = 1$.\n4. By [[Bézout's identity|0DQVHMYAGA]], there are integers $x$ and $y$ with $a x + n y = 1$.\n5. Then $a x - 1 = n (-y)$, so $n$ [[divides|096PW7Q014]] $a x - 1$. By the definition of [[congruence|0TPW25CBN6]], $a x \\equiv 1 \\pmod n$.\n6. So $x$ is a [[modular multiplicative inverse|00GXTQMY8Z]] of $a$ modulo $n$.\n7. Conversely, assume that $a$ has an inverse $x$ modulo $n$, so $a x \\equiv 1 \\pmod n$.\n8. Then $n$ divides $a x - 1$, so there is an integer $y$ with $a x - 1 = n y$. That is, $a x - n y = 1$.\n9. The integer $d$ divides $a$ and $n$, so it divides $a x - n y = 1$.\n10. Since $d$ is positive by step 2 and divides $1$, we get $d = 1$. So $a$ and $n$ are coprime.\n11. By steps 3 to 10, $a$ has an inverse modulo $n$ if and only if $a$ and $n$ are coprime.\n\n## Idea\n\nAn inverse $x$ of $a$ is the same thing as a way to write $1 = a x + n y$. Bézout's identity gives such a way when $\\gcd(a, n) = 1$. Conversely, any common divisor of $a$ and $n$ divides $a x + n y = 1$.\n",
  "commit": "4a3290d299c8b2cd6493fce2296920ba7f82d942",
  "front": {
    "kind": "proof",
    "methods": [
      "0NTF6DMVAP"
    ],
    "msc": [
      "11A07"
    ],
    "name": "Proof of the existence of inverses modulo n",
    "proves": "0M67FWZWPQ",
    "sources": [
      {
        "locator": "Integers modulo m",
        "url": "https://en.wikipedia.org/wiki/Modular_multiplicative_inverse"
      }
    ],
    "tag": "SC1CEH0NHE",
    "uses": [
      "00GXTQMY8Z",
      "0GFKP8F8AG",
      "02WF878BH1",
      "0DQVHMYAGA",
      "0TPW25CBN6",
      "096PW7Q014"
    ]
  },
  "kind": "proof",
  "link": "https://math2.tamnd.com/node/SC1CEH0NHE/",
  "links": [
    {
      "field": "proves",
      "target": "0M67FWZWPQ"
    },
    {
      "field": "uses",
      "target": "00GXTQMY8Z"
    },
    {
      "field": "uses",
      "target": "0GFKP8F8AG"
    },
    {
      "field": "uses",
      "target": "02WF878BH1"
    },
    {
      "field": "uses",
      "target": "0DQVHMYAGA"
    },
    {
      "field": "uses",
      "target": "0TPW25CBN6"
    },
    {
      "field": "uses",
      "target": "096PW7Q014"
    },
    {
      "field": "methods",
      "target": "0NTF6DMVAP"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/SC1CEH0NHE.md",
  "msc": [
    "11A07"
  ],
  "name": "Proof of the existence of inverses modulo n",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/SC1/SC1CEH0NHE.md",
  "status": null,
  "tag": "SC1CEH0NHE",
  "uri": "m2://SC1CEH0NHE",
  "url": "https://math2.tamnd.com/wiki/proof-of-the-existence-of-inverses-modulo-n/",
  "writing": {
    "tag": "SC1CEH0NHE",
    "kind": "proof",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      }
    ]
  }
}
