Let . We say is a quadratic residue if there exists
some such that . Otherwise is a quadratic nonresidue.
Efficiently distinguishing a quadratic residue from a nonresidue modulo
for primes is an open problem. This is exploited by several
cryptosystems, such as Goldwassser-Micali encryption, or Cocks identity-based
encryption. More general variants of this problem underlie other cryptosystems
such as Paillier encryption.
Let be an odd prime, as the case is trivial.
Let be a generator of .
Any can be written as for some
.
Say is even. Write . Then , so is a quadratic
residue. Exactly half of is even (since is odd), hence
at least half of the elements of are quadratic residues.
Suppose we have . Then as well, and since
(since ) every quadratic residue has at least
two square roots (in fact, we know from studying polynomials
there can be at most two),
thus at most half the elements of
are quadratic residues. (Otherwise there are more square roots than elements!)
Thus exactly half of are quadratic residues, and they
are the even powers of .
Given , consider the effect of exponentiating by .
If is odd, say , we get
The square of is , so is or .
But has order ( is a generator) thus we must have
.
In other words, we have proved Euler’s Criterion, which states
is a quadratic residue if and only if
, and is a quadratic nonresidue if and only if
.
Example: We have is a quadratic residue in
if and only if .