Sum of Euler Phi Function over Divisors

Theorem
Let $$n \in \Z^*_+$$, i.e. let $$n$$ be a positive integer.

Then $$\sum_{d \backslash n} \phi \left({d}\right) = n$$

where:
 * $$\sum_{d \backslash n}$$ denotes the sum over all of the divisors of $$n$$;
 * $$\phi \left({d}\right)$$ is the Euler $\phi$ function, the number of integers less than $$d$$ that are prime to $$d$$.

That is, the total of all the totients of all divisors of a number equals that number.

Strange but true.

Proof
Let us define $$S_d = \left\{{: 1 \le m \le n, \gcd \left\{{m, n}\right\} = d}\right\}$$.

That is, $$S_d$$ is all the numbers less than $$n$$ whose GCD is $$d$$.

Now from Divide by GCD for Coprime Integers we have $$\gcd \left\{{m, n}\right\} = d \iff \frac m d, \frac n d \in \Z: \frac m d \perp \frac n d$$.

So the number of integers in $$S_d$$ equals the number of positive integers no bigger than $$\frac n d$$ which are prime to $$n$$.

That is, $$\left|{S_d}\right| = \phi \left({\frac n d}\right)$$.

Now for each $$d_1, d_2, \ldots, d_{\tau \left({n}\right)}$$ there exists one $$S_{d_j}$$.

As each of the integers $$1, 2, \ldots, n$$ lies in exactly one of the $$S_{d_j}$$, it follows that:
 * $$n = \sum_{d \backslash n} \phi \left({\frac n d}\right)$$

But from Sum Over Divisors Equals Sum Over Quotients, $$\sum_{d \backslash n} \phi \left({\frac n d}\right) = \sum_{d \backslash n} \phi \left({d}\right)$$ and hence the result.