Advanced Number Theory Note #11: Derivation of a Möbius function formula for Ramanujan’s sums

I used a Möbius function formula for Ramanujan’s sums in a previous note and I want to show where this formula comes from in the present note (mainly as a technical memo for myself). The approach will be to show how Ramanujan’s sum

$c_k(n) = \sum_{\substack{m\hspace{1 mm} mod \hspace{1 mm}k \\ gcd(m, k)=1}} e^{2\pi imn/k}$            (1)

can be derived from a sum of the form

$s_k(n) = \sum_{d|gcd(n, k)}f(d)g\big(\frac{k}{d}\big)$        (2)

which is like a Dirichlet convolution $f \ast g$ except that the sum is only over a subset of the divisors $d$ of $k$, namely those which also divide $n$.

Formula (1) can be obtained as a special case of (2), via the result

$c_k(n) = \sum_{d|gcd(n, k)}d\mu\big(\frac{k}{d}\big)$        (3)

where $\mu$ is the Möbius function. In fact the Möbius function itself is a Ramanujan’s sum, and I showed in Advanced Number Theory Note #10 how to obtain it as a sum of primitive roots of unity like (1) above. It can also be seen directly from (3) by setting $n = 1$, in which case there is only one term in the sum and we get $c_k(1) = \mu(k)$. In addition, when $k|n$ we have $gcd(n, k) = k$ and

$c_k(n) = \sum_{d|k}d \mu(k/d) = \varphi(k)$

where the second equality was derived in Advanced Number Theory Note #1.

Focusing on the sum $s_k(n)$ in (2) above, note that $n$ occurs only in $gcd(n, k)$ which is a periodic function with period $k$, so we conclude that $s_k(n)$ must also be a periodic function with period $k$, so that

$s_k(n + k) = s_k(n)$

for all $n$. Therefore $s_k(n)$ must have a finite Fourier expansion, and the precise form of this is obtained in the following theorem.

Theorem 1. Let $s_k(n) = \sum_{d|gcd(n, k)}f(d)g(k/d)$. Then $s_k(n)$ has the finite Fourier expansion

$s_k(n) = \sum_{m\hspace{1 mm} mod \hspace{1 mm}k} a_k(m)e^{2\pi imn/k}$            (4)

where

$a_k(m) = \sum_{d|gcd(m, k)}g(d)f\big(\frac{k}{d}\big)\frac{d}{k}$         (5)

Proof: We can apply Theorem 4 in Advanced Number Theory Note #9, with the roles of the letters $m$ and $n$ interchanged, to get the following formula for the coefficients $a_k(m)$:

$a_k(m) = \frac{1}{k}\sum_{m\hspace{1 mm} mod \hspace{1 mm}k} s_k(n) e^{-2\pi imn/k}$

$= \frac{1}{k}\sum_{n=1}^k \sum_{\substack{d|n \\ d|k}}f(d)g\big(\frac{k}{d}\big) e^{-2\pi imn/k}$

We can write $n = cd$ for integer $c$ (since $d|n$) and observe that, since it is required that $d|n$ in the above sum, it must be the case that the index $c$ runs from 1 to $k/d$. Then we have

$a_k(m) = \frac{1}{k}\sum_{d|k}f(d)g\big(\frac{k}{d}\big) \sum_{c=1}^{k/d} e^{-2\pi icdm/k}$

We can now replace $d$ by $k/d$ in the sum on the right without affecting the sum (because both will run over the divisors of $k$) to get

$a_k(m) = \frac{1}{k}\sum_{d|k}f\big(\frac{k}{d}\big)g(d) \sum_{c=1}^d e^{-2\pi icm/d}$

But by Theorem 1 of Advanced Number Theory Note #9, the sum on $c$ is zero unless $d|m$ in which case the sum has the value $d$. Therefore

$a_k(m) = \frac{1}{k}\sum_{\substack{d|k \\ d|m}}f\big(\frac{k}{d}\big)g(d)d$

which proves (5). QED

Now we apply the formula in Theorem 1 with specialised $f$ and $g$ to obtain the Möbius function formula for Ramanujan’s sums in (3) above (which is the main thing we wanted to derive in this note).

Theorem 2. We have

$c_k(n) = \sum_{d|gcd(n, k)}d\mu\big(\frac{k}{d}\big)$

Proof: Taking $f(k) = k$ and $g(k) = \mu(k)$ in formula (4) in Theorem 1, we get

$\sum_{d|gcd(n, k)}d\mu\big(\frac{k}{d}\big) = \sum_{m\hspace{1 mm} mod \hspace{1 mm}k} a_k(m)e^{2\pi imn/k}$

where using the formula for $a_k(m)$ in Theorem 1 we get

$a_k(m) = \frac{1}{k}\sum_{\substack{d|k \\ d|m}}f\big(\frac{k}{d}\big)g(d)d$

$= \frac{1}{k}\sum_{d|gcd(m, k)}\frac{k}{d}\mu(d)d$

$= \sum_{d|gcd(m, k)}\mu(d)$

$= \big[\frac{1}{gcd(m, k)}\big]$

where the last equality is due to a property of the Möbius function proved in Advanced Number Theory Note #1. Therefore $a_k(m) = 1$ if $gcd(m, k) = 1$ and $a_k(m) = 0$ if $gcd(m, k) > 1$, so we conclude

$\sum_{d|gcd(n, k)}d\mu\big(\frac{k}{d}\big) = \sum_{\substack{m\hspace{1 mm} mod \hspace{1 mm}k \\ gcd(m, k)=1}} e^{2\pi imn/k} = c_k(n)$. QED