Sum of Möbius Function over Divisors

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

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

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$$;
 * $$\mu \left({d}\right)$$ is the Moebius function.

Lemma
$$\sum_{d \backslash n} \mu(d) = \left \lfloor {\frac{1}{n} } \right \rfloor \ $$

Proof of Lemma
The lemma is clearly true if $$n=1 \ $$. Assume, then, that $$n>1 \ $$ and write, by the fundamental theorem of arithmetic, $$n=p_1^{a_1} p_2^{a_2} \dots p_k^{a_k} \ $$. In the sum $$\sum_{d \backslash n} \mu(d) \ $$ the only non-zero terms come from $$d=1 \ $$ and the divisors of n which are products of distinct primes. Thus

$$\sum_{d \backslash n} \mu(d) = \mu(1) + \mu(p_1) + \dots + \mu(p_k) + \mu(p_1p_2) + \dots + \mu(p_{k-1}p_k) + \dots + \mu(p_1p_2\dots p_k) \ $$

$$= 1 + {k \choose 1} (-1) + {k \choose 2} (-1)^2 + \dots + {k \choose k}(-1)^k = (1-1)^k = 0 \ $$

Hence, the sum is $$1 \ $$ for $$n=1 \ $$, and $$0 \ $$ for $$n>1 \ $$, which are precisely the values of $$\left \lfloor {\frac{1}{n} } \right \rfloor \ $$.

Proof of Theorem
If $$1(k) = 1 \ $$ is the unity function, then $$\phi \ $$ is defined as

$$\phi(n) = \sum_{k \perp n} 1(k) \ $$

Since $$\gcd(n,k) \ $$ is $$1 \ $$ if $$k \perp n \ $$ and $$0 \ $$ otherwise, we can rewrite the above sum as

$$\sum_{k=1}^n \left \lfloor  {\frac{1}{\gcd(n,k)}}  \right \rfloor \ $$

Now we may use the lemma, with $$\gcd(n,k) \ $$ replacing $$n \ $$, to get

$$\phi(n) = \sum_{k=1}^n \left({ \sum_{d \backslash \gcd(n,k)} \mu(d) }\right) = \sum_{k=1}^n \sum_{ { {d \backslash n} \choose {d\backslash k}}} \mu(d) \ $$

For a fixed divisor $$d \ $$ of $$n \ $$ we must sum over all those $$k \ $$ in the range $$1 \leq k \leq n \ $$ which are multiples of $$d \ $$. If we write $$k=qd \ $$, then $$1 \leq k \leq n \ $$ if and only if $$1 \leq q \leq \tfrac{n}{d} \ $$. Hence the last sum for $$\phi(n) \ $$ can be written as

$$\phi(n) = \sum_{d \backslash n} \left({ \sum_{q=1}^{\tfrac{n}{d}} \mu(d) }\right) = \sum_{d \backslash n} \mu(d) \sum_{q=1}^{\tfrac{n}{d}} 1(q) = \sum_{d \backslash n} \mu(d)\frac{n}{d} \ $$