# Sum of quadratic residues in $[1,p)$ [duplicate]

Show that if $p$ is a prime of the form $4k + 1$, the sum of quadratic residues ($\bmod p$) in the interval $[1, p)$ is $\frac{p (p - 1)}{4}$.

My attempt :

I could prove that the sum of the quadratic residues $\bmod p$ is $\frac{k ( 2k + 1 ) ( 4k + 1 )}{3} \bmod p$ (where $p = 4k + 1$). $p$ already divides this.

So, the sum of quadratic residues is a multiple of $p$.

What else can I try ?

-

## marked as duplicate by DonAntonio, William, LVK, J. M., Rudy the ReindeerOct 3 '12 at 8:35

Thanks for the edit ! I'll be more careful in future. – jatin Sep 4 '12 at 16:50
This is an exact duplicate. I guess I should do a thorough search before posting. Can a moderator please close this ? – jatin Sep 4 '12 at 17:11
Don't worry, @Jatin. Though a thorough search is always advisable, sometimes not even veterans can find stuff. – DonAntonio Sep 4 '12 at 17:25

From here, the number of quadratic residue of an odd prime is $\frac{p-1}{2}$.

Now, if $x$ is a quadratic residue of $mod\ p$ , so is $p-x$ as $-1$ is a quadratic residue of any prime $≡1\pmod 4$.

Using Legendre Symbol, $(\frac{-x}{p})=(\frac{-1}{p})(\frac{x}{p})=(-1)^{\frac{p-1}{2}}(\frac{x}{p})=(\frac{x}{p})$ if $p≡1\pmod 4$.

So, we can always find an integer $p-x<p$ for each and every quadratic residue of $x<p$, so that their sum is $p$.

And $x≢p-x$ if $p$ is odd.

Clearly, there are in-congruent $\frac{p-1}{4}$ pairs if $4\mid(p-1)$ each pair having sum$=p$.

-
This makes sense. Thanks ! – jatin Sep 4 '12 at 16:56