Kluyver's Formula for Ramanujan's Sum

Theorem
Let $q \in \N_{>0}$.

Let $n \in \N$.

Let $c_q \left({n}\right)$ be Ramanujan's sum.

Let $\mu$ be the Möbius function.

Then:


 * $\displaystyle c_q \left({n}\right) = \sum_{d \mathop \backslash \gcd \left({q, n}\right)} d \mu \left({\frac q d}\right)$

where $\backslash$ denotes divisibility.

Proof
Let $\alpha \in \R$.

Let $e: \R \to \C$ be the mapping defined as:


 * $e \left({\alpha}\right) := \exp \left({2 \pi i \alpha}\right)$

Let $\zeta_q$ be a primitive $q$th root of unity.

Let:


 * $\displaystyle \eta_q \left({n}\right) := \sum_{1 \mathop \le a \mathop \le q} e \left({\frac {a n} q}\right)$

By Complex Roots of Unity in Exponential Form this is the sum of all $q$th roots of unity.

Therefore:


 * $\displaystyle \eta_q \left({n}\right) = \sum_{d \mathop \backslash q} c_d \left({n}\right)$

By the Möbius Inversion Formula, this gives:


 * $\displaystyle c_q \left({n}\right) = \sum_{d \mathop \backslash q} \eta_d \left({n}\right) \mu \left({\frac q d}\right)$

Now by Sum of Roots of Unity, we have:


 * $\displaystyle c_q \left({n}\right) = \sum_{d \mathop \backslash q} d \mu \left({\frac q d}\right)$

as required.