Sum of Möbius Function over Divisors

Theorem
Let $n \in \Z_{>0}$ be a strictly positive integer.

Then:


 * $\displaystyle \sum_{d \mathop \divides n} \map \mu d \frac n d = \map \phi n$

where:


 * $\displaystyle \sum_{d \mathop \divides n}$ denotes the sum over all of the divisors of $n$


 * $\map \phi n$ is the Euler $\phi$ function, the number of integers less than $n$ that are prime to $n$


 * $\map \mu d$ is the Möbius function.

Equivalently, this says that:


 * $\phi = \mu * I_{\Z_{>0} }$

where:
 * $*$ denotes Dirichlet convolution
 * $I_{\Z_{>0} }$ denotes the identity mapping on $\Z_{>0}$, that is:
 * $\forall n \in \Z_{>0}: I_{\Z_{>0} }: n \mapsto n$

Lemma
Let $\map 1 k = 1$ be the constant mapping.

Then $\phi$ is defined as:
 * $\displaystyle \map \phi n = \sum_{k \mathop \perp n} \map 1 k$

We have that $\gcd \set {n, k}$ is $1$ if $k \perp n$ and $0$ otherwise.

Thus we can rewrite the above sum as:
 * $\displaystyle \sum_{k \mathop = 1}^n \floor {\frac 1 {\gcd \set {n, k} } }$

Now we may use the lemma, with $\gcd \set {n, k}$ replacing $n$, to get:

For a fixed divisor $d$ of $n$, we must sum over all those $k$ in the range $1 \le k \le n$ which are multiples of $d$.

If we write $k = q d$, then $1 \le k \le n$ $1 \le q \le \dfrac n d$.

Hence the last sum for $\map \phi n$ can be written as: