# What is the sum of ALL of the nth powers of the qth roots of unity?

I am reading a Wikipedia article on Ramanujan's sum. The article states that:

It follows from the identity $x^q − 1 = (x − 1)(x^{q−1} + x^{q−2} + ... + x + 1)$ that the sum of the nth powers of All the qth roots of unity is \begin{cases}0&\;{\mbox{ if }}q\nmid n\\q&\;{\mbox{ if }}q\mid n\\\end{cases}

I think I understand the case for $q|n$. Every $q$th root of unity raised to a multiple of $q$ would equal $1$ so the sum is $1+1+1+...+1$ ($q$ summands of $1$). Right?

I also understand that the sum of all the $q$th roots of unity (not raised to any power) is $0$.

I have an intuitive hazy notion that if $q$ does not divide $n$ then the roots upon being raised to the $n$th power are mapped bijectively onto themselves so the sum is $0$.

How can I prove this? How does this follow from the given identity?

## 1 Answer

Your understanding for the case $q|n$ is right.

I use $x$ to denote a $q$-th root of unity for the rest of this answer. Note that $x^n = 1 \iff q | n$. If $q\nmid n$, $x^n \ne 1$. Substitute $x^n$ into the given identity and divide both sides by $x^n-1$.

$$\sum_{k=0}^{q-1} x^{nk} = \frac{x^{qn}-1}{x^n-1} = \frac{(x^{q})^n-1}{x^n-1} = \frac{1-1}{x^n-1}=0.$$