Complete Legendre-symbol sum (source code)

= Complete Legendre-symbol sum

For an <odd prime> $p$, the complete sum of the <Legendre symbol> is
$$
\sum_{x\in\mathbb F_p}\left(\frac xp\right)=0.
$$
Choose a <quadratic nonresidue> $a$. Multiplication by $a$ permutes the <finite field> $\mathbb F_p$, while <multiplicativity of the Legendre symbol> gives $(ax/p)=-(x/p)$. The sum is therefore equal to its own negative, and is zero. Equivalently, among the $p-1$ nonzero <residue classes>, exactly half are <quadratic residues> and half are <quadratic nonresidues>; the zero term contributes zero.