{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Proof\n\nWe sort the integers $1, \\dots, n$ by their greatest common divisor with $n$.\n\n1. Let $n$ be a positive integer. For each positive [[divisor|096PW7Q014]] $d$ of $n$, let $S_d$ be the set of integers $k$ with $1 \\le k \\le n$ and $\\gcd(k, n) = n / d$.\n2. Let $1 \\le k \\le n$. The [[greatest common divisor|02WF878BH1]] $g = \\gcd(k, n)$ is a positive divisor of $n$. So $d = n / g$ is a positive divisor of $n$, and $k \\in S_d$.\n3. The sets $S_d$ are pairwise disjoint, since $n / d$ determines $d$. With step 2, they partition $\\{ 1, \\dots, n \\}$. So $n = \\sum_{d \\mid n} \\abs{S_d}$.\n4. Fix a positive divisor $d$ of $n$, and let $e = n / d$, so $n = e d$. We show that $\\abs{S_d} = \\varphi(d)$, where $\\varphi$ is [[Euler's totient function|0VV04M41AN]].\n5. If $k \\in S_d$, then $e = \\gcd(k, n)$ divides $k$. So $k = e j$ for an integer $j$, and $1 \\le k \\le n$ gives $1 \\le j \\le d$.\n6. So it suffices to show, for $1 \\le j \\le d$, that $\\gcd(e j, e d) = e$ if and only if $\\gcd(j, d) = 1$.\n7. Assume $\\gcd(j, d) = c \u003e 1$. Then $e c$ divides $e j$ and $e d$. So $\\gcd(e j, e d) \\ge e c \u003e e$.\n8. Assume $\\gcd(j, d) = 1$. By [[Bézout's identity|0DQVHMYAGA]], $j u + d v = 1$ for some integers $u$ and $v$. Then $(e j) u + (e d) v = e$.\n9. So each common divisor of $e j$ and $e d$ divides $e$, and is at most $e$. Since $e$ is itself a common divisor, $\\gcd(e j, e d) = e$.\n10. By steps 5 to 9, $k \\mapsto k / e$ is a bijection from $S_d$ onto the set of $j$ with $1 \\le j \\le d$ and $j$ [[coprime|0GFKP8F8AG]] to $d$. That set has $\\varphi(d)$ elements, so $\\abs{S_d} = \\varphi(d)$.\n11. By steps 3 and 10, $\\sum_{d \\mid n} \\varphi(d) = n$.\n\n## Idea\n\nGroup the numbers $1, \\dots, n$ by their gcd with $n$. The numbers with gcd $n / d$ are $n / d$ times the numbers up to $d$ that are coprime to $d$, so there are $\\varphi(d)$ of them. Adding over all groups counts each of $1, \\dots, n$ once.\n",
  "commit": "4a3290d299c8b2cd6493fce2296920ba7f82d942",
  "front": {
    "kind": "proof",
    "methods": [
      "0NTF6DMVAP"
    ],
    "msc": [
      "11A25"
    ],
    "name": "Proof of the sum of the totient over the divisors",
    "proves": "09JXE6XMCC",
    "sources": [
      {
        "locator": "Divisor sum",
        "url": "https://en.wikipedia.org/wiki/Euler%27s_totient_function"
      }
    ],
    "tag": "32JRQJ5MKN",
    "uses": [
      "0VV04M41AN",
      "096PW7Q014",
      "02WF878BH1",
      "0GFKP8F8AG",
      "0DQVHMYAGA"
    ]
  },
  "kind": "proof",
  "link": "https://math2.tamnd.com/node/32JRQJ5MKN/",
  "links": [
    {
      "field": "proves",
      "target": "09JXE6XMCC"
    },
    {
      "field": "uses",
      "target": "0VV04M41AN"
    },
    {
      "field": "uses",
      "target": "096PW7Q014"
    },
    {
      "field": "uses",
      "target": "02WF878BH1"
    },
    {
      "field": "uses",
      "target": "0GFKP8F8AG"
    },
    {
      "field": "uses",
      "target": "0DQVHMYAGA"
    },
    {
      "field": "methods",
      "target": "0NTF6DMVAP"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/32JRQJ5MKN.md",
  "msc": [
    "11A25"
  ],
  "name": "Proof of the sum of the totient over the divisors",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/32J/32JRQJ5MKN.md",
  "status": null,
  "tag": "32JRQJ5MKN",
  "uri": "m2://32JRQJ5MKN",
  "url": "https://math2.tamnd.com/wiki/proof-of-the-sum-of-the-totient-over-the-divisors/",
  "writing": {
    "tag": "32JRQJ5MKN",
    "kind": "proof",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      }
    ]
  }
}
