# Mobius inversion formula

The Möbius Inversion Formula is a relation between pairs of arithmetic functions, each defined from the other by sums over divisors. Originally proposed by August Ferdinand Möbius in 1832, it has many uses in Number Theory and Combinatorics.

### The Formula

Let $g$ and $f$ be arithmetic functions and $\mu$ denote the Möbius Function. Then it follows that

$g(n)=\sum_{d|n}f(d)\leftrightarrow f(n)=\sum_{d|n}\mu(d)g\left(\frac{n}{d}\right)=\sum_{d|n}\mu\left(\frac{n}{d}\right)g(d).$

$\textit{Proof}$: Notice the double implication, so we have two directions to prove. We proceed with the proof of the backwards direction first. We have

$\sum_{d|n}\mu(d)g\left(\frac{n}{d}\right)=\sum_{d|n}\mu(d)\sum_{c|\frac{n}{d}}f(c)=\sum_{cd|n}\mu(d)f(c)=\sum_{c|n}f(c)\sum_{d|\frac{n}{c}}\mu(d).$

To finish, we will use the fact that

$\sum_{d|n}\mu(d)=1~\text{for}~n=1~,\sum_{d|n}\mu(d)=0~\text{for}~n>1.$

If we have $\frac{n}{c}=1\leftrightarrow n=c$ then we have

$\sum_{d|\frac{n}{c}}\mu(d)=\sum_{d|1}\mu(d)=1$

and that $\sum_{d|\frac{n}{c}}\mu(d)=0$ if otherwise. Hence by considering $n=c$ we get

$\sum_{c|n}f(c)\sum_{d|\frac{n}{c}}\mu(d)=\sum_{c|n}f(c)=f(n).$

The first direction is satisfied, and now we must prove the second. We see that

$\sum_{d|n}f(d)=\sum_{d|n}f\left(\frac{n}{d}\right)=\sum_{d|n}\sum_{c|\frac{n}{d}}\mu\left(\frac{n}{cd}\right)g(c)=\sum_{cd|n}\mu\left(\frac{n}{cd}\right)g(c)=\sum_{c|n}g(c)\sum_{d|\frac{n}{c}}\mu\left(\frac{n}{cd}\right)=g(n).$

Both directions have been proven, which completes our work $\square$

### Applications

One of the most common applications of the formula is by proving that

$n=\sum_{d|n}\varphi(d)$.

While there are some common combinatorial and group theoretic arguments one could use, a Möbius Inversion Formula solution also suffices. Clearly by choosing $g(n)=n$ and $f(n)=\varphi(n)$ the theorem is proven.