# sums of legendre symbol

I am studying the sums of Legendre symbol. It's easy to prove that for $p\equiv 1 \pmod 4$, $$\sum_{0<n<p/2}\left(\frac{n}{p}\right)=0.$$ by writing the sum over all residue classes and then using the fact that sum over $0$ to $p/2$ is same as $p/2$ to $p$ (by a change of variable). But the same idea is not working with the following two equalities:

(1) If $p\equiv 3 \pmod 8$, then $$\sum_{0<n<p/4} \left(\frac{n}{p}\right) =0.$$ (2) If $p\equiv 7 \pmod 8$, then $$\sum_{p/4<n<p/2} \left(\frac{n}{p}\right) =0.$$ Thanks in advance for any help.

-

(1) If $p \equiv 3 \pmod{8}$ then $(\frac{-1}{p})=(\frac{2}{p})=-1$. Let $p=8k+3$. Observe that

\begin{align} \sum_{1 \leq n \leq 2k}{(\frac{n}{p})}+\sum_{2k+1 \leq n \leq 4k+1}{(\frac{n}{p})}& =\sum_{1 \leq n \leq 4k+1}{(\frac{n}{p})} \\ & =\sum_{1 \leq n \leq 2k}{(\frac{2n}{p})}+\sum_{1 \leq n \leq 2k+1}{(\frac{2n-1}{p})} \\ & =(\frac{2}{p})\sum_{1 \leq n \leq 2k}{(\frac{n}{p})}+(\frac{-1}{p})\sum_{1 \leq n \leq 2k+1}{(\frac{p+1-2n}{p})} \\ & =(\frac{2}{p})\sum_{1 \leq n \leq 2k}{(\frac{n}{p})}+(\frac{-1}{p})\sum_{2k+1 \leq n \leq 4k+1}{(\frac{2n}{p})} \\ & =(\frac{2}{p})\sum_{1 \leq n \leq 2k}{(\frac{n}{p})}+(\frac{-1}{p})(\frac{2}{p})\sum_{2k+1 \leq n \leq 4k+1}{(\frac{n}{p})} \\ & =-\sum_{1 \leq n \leq 2k}{(\frac{n}{p})}+\sum_{2k+1 \leq n \leq 4k+1}{(\frac{n}{p})} \end{align}

Thus

$$\sum_{0<n<\frac{p}{4}}{(\frac{n}{p})}=\sum_{1 \leq n \leq 2k}{(\frac{n}{p})}=0$$

(2) If $p \equiv 7 \pmod{8}$ then $(\frac{-1}{p})=-1, (\frac{2}{p})=1$. Let $p=8k+7$. Observe that

\begin{align} \sum_{1 \leq n \leq 2k+1}{(\frac{n}{p})}+\sum_{2k+2 \leq n \leq 4k+3}{(\frac{n}{p})}& =\sum_{1 \leq n \leq 4k+3}{(\frac{n}{p})} \\ & =\sum_{1 \leq n \leq 2k+1}{(\frac{2n}{p})}+\sum_{1 \leq n \leq 2k+2}{(\frac{2n-1}{p})} \\ & =(\frac{2}{p})\sum_{1 \leq n \leq 2k+1}{(\frac{n}{p})}+(\frac{-1}{p})\sum_{1 \leq n \leq 2k+2}{(\frac{p+1-2n}{p})} \\ & =(\frac{2}{p})\sum_{1 \leq n \leq 2k+1}{(\frac{n}{p})}+(\frac{-1}{p})\sum_{2k+2 \leq n \leq 4k+3}{(\frac{2n}{p})} \\ & =(\frac{2}{p})\sum_{1 \leq n \leq 2k+1}{(\frac{n}{p})}+(\frac{-1}{p})(\frac{2}{p})\sum_{2k+2 \leq n \leq 4k+3}{(\frac{n}{p})} \\ & =\sum_{1 \leq n \leq 2k+1}{(\frac{n}{p})}-\sum_{2k+2 \leq n \leq 4k+3}{(\frac{n}{p})} \end{align}

Thus

$$\sum_{\frac{p}{4}<n<\frac{p}{2}}{(\frac{n}{p})}=\sum_{2k+2 \leq n \leq 4k+3}{(\frac{n}{p})}=0$$

-