# A problem with the Legendre/Jacobi symbols: $\sum_{n=1}^{p}\left(\frac{an+b}{p}\right)=0$ [duplicate]

This problem is taken from Niven's textbook, 3.6.16. Prove that if $(a,p)=1$ and $p$ is an odd prime, then $\sum_{n=1}^{p}\left(\frac{an+b}{p}\right)=0$, where $\left(\frac{x}{y}\right)$ is the Legendre/Jacobi symbol. I feel that somehow, I have to show that the number of $-1$ must be the same of the number of $1$, but other than that, I don't really know how to tackle the problem. I did try a few examples, but there is no pattern as $b$ changes.
Hint: As $n$ ranges from $1$ to $p$, $an+b$ ranges over all residue classes modulo $p$.