Exercise 1339Number theory › CongruencesOlympiadAdded 5 Nov 2026
The sum of the quadratic residues modulo p
#quadratic residues#sum of squares#divisibility
Statement
Let be a prime. The nonzero quadratic residues modulo are the residues for which has a solution. Prove that the sum of all of them is divisible by .
Hint
Show first that the residues are exactly the squares with , all distinct modulo .
Show solutionHide solution
Solution
Step 1: there are exactly residues, represented by . Any is congruent to for some , so . For , with and , so : the squares are distinct modulo .
Step 2: the sum. Each residue is congruent to some , so
using , , .
Step 3: divisibility. For a prime , is odd and not a multiple of , so is divisible by and by . Hence and is a multiple of .
Check. : residues , sum ✓. : residues , sum ✓.
Lesson. To sum a set of residues, replace each by a convenient representative, here the squares with .