Legendre Symbol: $ \sum_{a=3}^{p-1} (\frac{a}{p})$ for $p>3$ I'm study number theory when I see that question and I don't know how to solve it.
Can anyone help me?
Calculate $ \sum_{a=3}^{p-1}(\frac{a}{p})$ for $p>3$, where $(\frac{a}{p})$ is the Legendre symbol.
 A: As @dezdichado has been mentioned, there are exactly $\dfrac{p-1}{2}$ [non-zero] quadratic residue module $p$, and there are exactly $\dfrac{p-1}{2}$ non-residue.


You can prove this fact this way:


*

*first notice that $x^2 \equiv y^2$ module $p$ implies that:


$x \equiv \pm y$ module $p$;
notice that:
$p \mid (x^2-y^2)=(x-y)(x+y)$ if and only if $p \mid(x-y)$ or $p \mid(x+y)$.


*

*So the above implies that, there is a one-to-one correspondence between the [non-zero] quadratic residues and $\{ 1, 2, 3, ..., (\dfrac{p-1}{2}-1), (\dfrac{p-1}{2}-1) \}$ module the below equivalence relation:


$x \sim y \Longleftrightarrow$ $x \equiv \pm y$, module $p$.
[In the group theoretic sense; the quoteint group:
$\{ 1, 2, 3, ..., (\dfrac{p-1}{2}-1), (\dfrac{p-1}{2}-1) \} / \{\pm1\}$.]
Equivalently consider these sets:
$\{\pm1\}, \{\pm2\}, ...\{ \pm (\dfrac{p-1}{2}-1)\}, \{\pm (\dfrac{p-1}{2})\}$;
one can easilly checks that, there is a one-to-one correspondence between these sets and the [non-zero] quadratic residues.


By this fact, one can easilly see that:
 $\sum_{a=1}^{p-1}(\dfrac{a}{p})=0$.
So we have:
$\sum_{a=3}^{p-1}(\dfrac{a}{p})=-\Big((\dfrac{1}{p})+ (\dfrac{2}{p})\Big) + \Bigg( \Big((\dfrac{1}{p})+ (\dfrac{2}{p})\Big) +\sum_{a=3}^{p-1}(\dfrac{a}{p})\Bigg)= - \Big((\dfrac{1}{p})+ (\dfrac{2}{p})\Big) + \sum_{a=1}^{p-1}(\dfrac{a}{p})= -\Big((\dfrac{1}{p})+ (\dfrac{2}{p})\Big) +0 = - \Big((\dfrac{1}{p})+ (\dfrac{2}{p})\Big)$


So it remains to compute $\Big((\dfrac{1}{p})+ (\dfrac{2}{p})\Big)$. But we know that $(\dfrac{1}{p})=1$; so it suffices only to compute $(\dfrac{2}{p})$; which is a famous classical problem.


For $5 \leq p$ we know that $(\dfrac{2}{p})=(-1)^{\dfrac{p^2-1}{8}}$; so we can conclud that:
$\sum_{a=3}^{p-1}(\dfrac{a}{p})=- \Big(1+(-1)^{\dfrac{p^2-1}{8}} \Big)$.
In other words the summation is equal to $-2$, if $p$ is congruent to $1$ or $7$ module $8$;
and it is equal to zero, if $p$ is congruent to $3$ or $5$ module $8$.
A: Hint: There are exactly $\dfrac{p-1}{2}$ quadratic residues $\mod p.$ You can prove this using the simple fact that the equation: $$x^2 = a \mod p$$ has either exactly two solutions or no solution in $\mathbb{F}_p.$
