Quadratic Residues
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 a prime. From now assume , 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 (actually 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 .
If is even, say , then .
Thus one way to tell if is a quadratic residue is to compute : if the result is , then is a quadratic residue, otherwise the result is and is a quadratic nonresidue.
Example: In , if is even (so ), then is a quadratic residue, otherwise is a quadratic nonresidue.
The Legendre Symbol
This fact (sometimes called Euler’s Criterion) is so useful that we define the Legendre symbol for odd primes and integers by
The symbol can also be written as .
Thus:
-
if is a quadratic residue of
-
if is a quadratic nonresidue of
-
if modulo
Some basic properties: for any integer
and for any coprime to