{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Proof\n\nWe prove the two directions separately.\n\n1. Let $n \\geq 1$ and $a$ be integers. Write $[b]$ for the [[residue class|0QRV8FPK5M]] of an integer $b$ modulo $n$, so $[b] = b + n\\Z$.\n2. In the ring [[$\\Z/n\\Z$|01N3AYAA6N]] the product is $[b][c] = [bc]$, and the identity is $[1]$. The ring is commutative, because $bc = cb$.\n3. If $b = c + nm$ for an integer $m$, then $b + n\\Z = c + n\\Z$, so $[b] = [c]$.\n4. If $[b] = [c]$, then $b \\in [b] = [c] = c + n\\Z$, so $b = c + nm$ for an integer $m$.\n5. First assume $\\gcd(a, n) = 1$. By [[Bézout's identity|0DQVHMYAGA]], there are integers $x$ and $y$ with $ax + ny = 1$.\n6. Then $ax = 1 + n(-y)$. By step 3, $[a][x] = [ax] = [1]$.\n7. By step 2, also $[x][a] = [1]$. So $[a]$ is a [[unit|019NFGFPR5]] of $\\Z/n\\Z$, with inverse $[x]$.\n8. Now assume that $[a]$ is a unit. Then there is a class $[x]$ with $[a][x] = [1]$, that is, $[ax] = [1]$.\n9. By step 4, there is an integer $m$ with $ax = 1 + nm$, so $1 = ax - nm$.\n10. Let $d = \\gcd(a, n)$ be the [[greatest common divisor|02WF878BH1]]. It exists and $d \\geq 1$, because $n \\geq 1$, so $a$ and $n$ are not both $0$.\n11. The integer $d$ divides $a$ and $n$, so it divides $ax - nm = 1$.\n12. A positive divisor of $1$ is $1$, so $d = 1$.\n13. Thus $[a]$ is a unit of $\\Z/n\\Z$ if and only if $\\gcd(a, n) = 1$.\n\n## Idea\n\nAn inverse of $[a]$ is an integer $x$ with $ax + ny = 1$ for some integer $y$. Bézout's identity gives such $x$ and $y$ exactly when $\\gcd(a, n) = 1$. Conversely, such an equation forces every common divisor of $a$ and $n$ to divide $1$.\n",
  "commit": "4a3290d299c8b2cd6493fce2296920ba7f82d942",
  "front": {
    "kind": "proof",
    "msc": [
      "11A07",
      "20K01"
    ],
    "name": "Proof that the units of Z/nZ are the residues coprime to n",
    "proves": "0GXNHEHQNA",
    "sources": [
      {
        "url": "https://proofwiki.org/wiki/Multiplicative_Inverse_in_Monoid_of_Integers_Modulo_m"
      }
    ],
    "tag": "TKE9RVC3TQ",
    "uses": [
      "01N3AYAA6N",
      "0QRV8FPK5M",
      "019NFGFPR5",
      "02WF878BH1",
      "0DQVHMYAGA"
    ]
  },
  "kind": "proof",
  "link": "https://math2.tamnd.com/node/TKE9RVC3TQ/",
  "links": [
    {
      "field": "proves",
      "target": "0GXNHEHQNA"
    },
    {
      "field": "uses",
      "target": "01N3AYAA6N"
    },
    {
      "field": "uses",
      "target": "0QRV8FPK5M"
    },
    {
      "field": "uses",
      "target": "019NFGFPR5"
    },
    {
      "field": "uses",
      "target": "02WF878BH1"
    },
    {
      "field": "uses",
      "target": "0DQVHMYAGA"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/TKE9RVC3TQ.md",
  "msc": [
    "11A07",
    "20K01"
  ],
  "name": "Proof that the units of Z/nZ are the residues coprime to n",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/TKE/TKE9RVC3TQ.md",
  "status": null,
  "tag": "TKE9RVC3TQ",
  "uri": "m2://TKE9RVC3TQ",
  "url": "https://math2.tamnd.com/wiki/proof-that-the-units-of-z-nz-are-the-residues-coprime-to-n/",
  "writing": {
    "tag": "TKE9RVC3TQ",
    "kind": "proof",
    "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
      }
    ]
  }
}
