{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Proof\n\n1. Let $n$ be a positive integer and let $a$ be an integer [[coprime|0GFKP8F8AG]] to $n$. Let $R$ be the set of integers $r$ with $1 \\le r \\le n$ and $\\gcd(r, n) = 1$.\n2. By the definition of [[Euler's totient function|0VV04M41AN]], $R$ has $\\varphi(n)$ elements.\n3. By the [[existence of inverses modulo n|0M67FWZWPQ]], an integer is coprime to $n$ if and only if it has a [[modular multiplicative inverse|00GXTQMY8Z]] modulo $n$. Let $x$ be an inverse of $a$, so $a x \\equiv 1 \\pmod n$.\n4. Let $r \\in R$, and let $y$ be an inverse of $r$. By [[compatibility with multiplication|072D5G4SK6]], $(a r)(x y) = (a x)(r y) \\equiv 1 \\cdot 1 = 1 \\pmod n$.\n5. By the [[division algorithm|0CHQKZFK5S]], $a r = q n + t$ with $0 \\le t \u003c n$. Let $s(r) = t$ if $t \u003e 0$, and $s(r) = n$ if $t = 0$. Then $1 \\le s(r) \\le n$ and $n$ [[divides|096PW7Q014]] $a r - s(r)$, so $s(r) \\equiv a r \\pmod n$.\n6. By steps 4 and 5 and compatibility with multiplication, $s(r) (x y) \\equiv (a r)(x y) \\equiv 1 \\pmod n$. So $s(r)$ has an inverse, and by step 3, $s(r) \\in R$.\n7. Let $r, r' \\in R$ with $s(r) = s(r')$. Then $a r \\equiv a r' \\pmod n$. Multiplying by $x$ gives $(x a) r \\equiv (x a) r' \\pmod n$, so $r \\equiv r' \\pmod n$ by step 3.\n8. Since $r$ and $r'$ lie in $\\{ 1, \\dots, n \\}$, their difference has absolute value less than $n$. As $n$ divides it, $r = r'$.\n9. By steps 6 to 8, $s$ is an injective map from the finite set $R$ to itself. So $s$ is a bijection of $R$, and $\\prod_{r \\in R} s(r) = \\prod_{r \\in R} r$.\n10. Let $P = \\prod_{r \\in R} r$. By steps 5 and 9 and compatibility with multiplication, $a^{\\varphi(n)} P = \\prod_{r \\in R} (a r) \\equiv \\prod_{r \\in R} s(r) = P \\pmod n$.\n11. Each $r \\in R$ has an inverse $y_r$. Let $z = \\prod_{r \\in R} y_r$. By compatibility with multiplication, $P z = \\prod_{r \\in R} (r y_r) \\equiv 1 \\pmod n$.\n12. Multiply the congruence of step 10 by $z$. This gives $a^{\\varphi(n)} (P z) \\equiv P z \\pmod n$.\n13. By step 11, $a^{\\varphi(n)} (P z) \\equiv a^{\\varphi(n)} \\pmod n$ and $P z \\equiv 1 \\pmod n$. With step 12, $a^{\\varphi(n)} \\equiv 1 \\pmod n$.\n\n## Idea\n\nMultiplying the residues coprime to $n$ by $a$ only shuffles them, because $a$ can be undone by its inverse. So the product $P$ of these residues equals $a^{\\varphi(n)} P$ modulo $n$. Since $P$ is invertible, we can cancel it.\n",
  "commit": "4a3290d299c8b2cd6493fce2296920ba7f82d942",
  "front": {
    "kind": "proof",
    "methods": [
      "0NTF6DMVAP"
    ],
    "msc": [
      "11A07"
    ],
    "name": "Proof of Euler's theorem by rearrangement",
    "proves": "0VC4DVE7DQ",
    "sources": [
      {
        "locator": "Proofs",
        "url": "https://en.wikipedia.org/wiki/Euler%27s_theorem"
      }
    ],
    "tag": "DBX26C9SMJ",
    "uses": [
      "0VV04M41AN",
      "0GFKP8F8AG",
      "0TPW25CBN6",
      "096PW7Q014",
      "00GXTQMY8Z",
      "0M67FWZWPQ",
      "0CHQKZFK5S",
      "072D5G4SK6"
    ]
  },
  "kind": "proof",
  "link": "https://math2.tamnd.com/node/DBX26C9SMJ/",
  "links": [
    {
      "field": "proves",
      "target": "0VC4DVE7DQ"
    },
    {
      "field": "uses",
      "target": "0VV04M41AN"
    },
    {
      "field": "uses",
      "target": "0GFKP8F8AG"
    },
    {
      "field": "uses",
      "target": "0TPW25CBN6"
    },
    {
      "field": "uses",
      "target": "096PW7Q014"
    },
    {
      "field": "uses",
      "target": "00GXTQMY8Z"
    },
    {
      "field": "uses",
      "target": "0M67FWZWPQ"
    },
    {
      "field": "uses",
      "target": "0CHQKZFK5S"
    },
    {
      "field": "uses",
      "target": "072D5G4SK6"
    },
    {
      "field": "methods",
      "target": "0NTF6DMVAP"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/DBX26C9SMJ.md",
  "msc": [
    "11A07"
  ],
  "name": "Proof of Euler's theorem by rearrangement",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/DBX/DBX26C9SMJ.md",
  "status": null,
  "tag": "DBX26C9SMJ",
  "uri": "m2://DBX26C9SMJ",
  "url": "https://math2.tamnd.com/wiki/proof-of-eulers-theorem-by-rearrangement/",
  "writing": {
    "tag": "DBX26C9SMJ",
    "kind": "proof",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      }
    ]
  }
}
