# Can you prove this identity involving the divisor sum function?

Let $$\sigma(n)=\sum_{d\mid n}d$$ the sum of divisor function. I've deduced, but I don't know how prove directly

$$\sigma(n)=\sum_{m=1}^{n}\sum_{k=1}^{m}(-1)^{nk}\cos\left(\frac{\pi n(2-m)k}{m}\right).$$

Question. Can you prove it? Thanks in advance.

• Other example $$\sigma(6)=\sum_{i=1}^6\sum_{j=1}^i\cos\left(6\frac{2\pi(1-i)j}{i}\right)=13+(-1-\sqrt{5})/2+(\sqrt{5}-1)/2=12.$$ In Wolfram Language: Sum[cos(2*(pi)*6(1-i)j/i), {i, 1, 6}, {j, 1, i}] – user243301 Feb 15 '16 at 10:47

Suppose we have the usual $\sigma(n) = \sum_{d|n} d$ and wish to show that

$$\sigma(n) = \sum_{m=1}^n \sum_{k=1}^m (-1)^{nk} \cos\left(\frac{\pi n(2-m)k}{m}\right).$$

This is

$$\sum_{m=1}^n \sum_{k=1}^m (-1)^{nk} (-1)^{nk} \cos\left(\frac{2\pi nk}{m}\right) = \Re \left(\sum_{m=1}^n \sum_{k=1}^m e^{2\pi i nk /m}\right).$$

which is $$\Re \left(\sum_{m=1}^n e^{2\pi i n/m} \sum_{k=0}^{m-1} e^{2\pi i nk /m}\right) = \Re \left(\sum_{m=1}^n e^{2\pi i n/m} \times m \times [[m|n]]\right) \\ = \Re\left(\sum_{m|n} m\right) = \sigma(n)$$

as claimed.

Here we have used the fact that

$$\sum_{k=0}^{m-1} e^{2\pi i nk /m} = \frac{e^{2\pi i n}-1}{e^{2\pi i n/m}-1} = 0$$

when $e^{2\pi i n/m} \ne 1$ and $m$ otherwise which yields $$m\times[[m|n]].$$

• Very thanks much, incredible. I take notes to study your proof. – user243301 Feb 9 '16 at 7:46