Kluyver's Formula for Ramanujan's Sum

Theorem
For $q \in \N$, $n \in \N\cup\{0\}$ let $c_q(n)$ be Ramanujan's sum.

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


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

Proof
For $\alpha \in \R$ let $e(\alpha) = \exp(2 \pi i \alpha)$.

Let $\zeta_q$ be a primitive $q^\text{th}$ root of unity, and:


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

By Roots of Unity this is the sum of all $q^\text{th}$ roots of unity.

Therefore:


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

By the Möbius Inversion Formula, this gives:


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

Now by Sum of Roots of Unity, we have:


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

as required.