Quadratic Residues
Quadratic Residues
Quadratic residues are integers that are perfect squares modulo a given modulus. The study of quadratic residues is central to number theory and has applications in cryptography, primality testing, and the theory of quadratic forms.
The crown jewel of this theory is the Law of Quadratic Reciprocity, which Gauss called the golden theorem and proved multiple times using different methods.
Definition
Let be an odd prime and an integer not divisible by . Then is a quadratic residue modulo if the congruence has a solution.
If no such solution exists, is called a quadratic nonresidue modulo .
Example
Modulo , the squares are , , , , , .
So the quadratic residues mod are and the nonresidues are .
The Legendre Symbol
The Legendre symbol encodes whether a is a quadratic residue modulo the odd prime :
Eulers Criterion
The Legendre symbol can be computed using Eulers criterion:
This follows from Fermat's little theorem: , so .
Properties of the Legendre Symbol
The Legendre symbol is multiplicative:
This makes it a completely multiplicative function of .
Special Values
When is -1 a Quadratic Residue?
So -1 is a quadratic residue mod p if and only if p is congruent to 1 mod 4.
When is 2 a Quadratic Residue?
So is a quadratic residue mod if and only if is congruent to plus or minus mod .
The Law of Quadratic Reciprocity
Let and be distinct odd primes. Then:
Equivalently, unless both and are congruent to , in which case .
This remarkable theorem allows us to compute Legendre symbols efficiently by reducing large numbers modulo small primes.
The Jacobi Symbol
The Jacobi symbol generalizes the Legendre symbol to composite odd moduli. For (odd), define:
The Jacobi symbol retains the multiplicativity and reciprocity properties, making it useful for computation even when we do not know the factorization of .
Counting Quadratic Residues
Among the integers , exactly are quadratic residues and are nonresidues.
This follows because the squaring map is two-to-one on the nonzero elements: and have the same square.
Applications
Primality Testing
The Solovay-Strassen primality test uses the Jacobi symbol and Euler's criterion. If is prime, then the Jacobi symbol equals for all . Composites usually fail this test.
Cryptography
Quadratic residuosity is the basis for several cryptographic systems. The Goldwasser-Micali cryptosystem uses the difficulty of distinguishing quadratic residues from nonresidues modulo a composite.
Solving Quadratic Congruences
To solve when is a quadratic residue, the Tonelli–Shanks algorithm efficiently finds square roots modulo primes.
Gaussian Periods and Gauss Sums
Gauss sums are exponential sums that encode information about quadratic residues:
Gauss showed that . These sums are fundamental in algebraic number theory and the proof of quadratic reciprocity.
Historical Note
Euler and Legendre studied quadratic residues and conjectured the reciprocity law. Gauss provided the first complete proof in 1796 at age 18, later giving seven more proofs using different methods.
Quadratic reciprocity inspired the search for higher reciprocity laws, leading to class field theory and modern algebraic number theory.
Algorithm for Computing Legendre Symbol
To compute efficiently:
Reduce modulo .
Factor out powers of and use the formula for .
For odd factors, use quadratic reciprocity to swap the arguments.
Reduce the arguments and repeat until the result is determined.
This is similar to the Euclidean algorithm and runs in polynomial time.
Distribution of Quadratic Residues
Quadratic residues are not randomly distributed. Consecutive quadratic residues and nonresidues exhibit patterns studied by number theorists.
The least quadratic nonresidue modulo is expected to be for most primes, though proving good bounds unconditionally remains difficult.
Quadratic residues form a fundamental concept connecting number theory, algebra, and cryptography, with the Law of Quadratic Reciprocity standing as one of the most beautiful theorems in mathematics.
Quadratic Character
The Legendre symbol defines a group homomorphism from the multiplicative group of integers mod to . This is the unique quadratic character modulo , a concept generalized by Dirichlet characters in analytic number theory.