Quadratic Residues and the Legendre Symbol
One-line: A quadratic residue mod is a nonzero square in , and the Legendre symbol encodes whether is such a square. Key result: Euler's criterion gives , and quadratic reciprocity relates to . Applies in: elementary and algebraic number theory, primality testing, cryptography, the theory of -functions. Who/when: Euler (1750s), Legendre (1798), Gauss (first proof of reciprocity, 1796/1801).For an odd prime , an integer coprime to is a quadratic residue (QR) if the congruence has a solution, and a quadratic nonresidue (QNR) otherwise. The Legendre symbol packages this dichotomy into a completely multiplicative function valued in , transforming questions about square roots mod into algebra over the finite field . This matters because solvability of is the simplest nontrivial local condition in number theory — the seed from which class field theory and the Langlands program grow. The surprising fact, which Gauss called the theorema aureum ("golden theorem"), is quadratic reciprocity: whether is a square mod is governed by whether is a square mod , even though these two questions concern entirely different finite fields, with a correction term depending only on .
The Core Insight
The nonzero residues mod form a cyclic group of even order . The squaring map is a 2-to-1 homomorphism, so exactly half the residues are squares. The Legendre symbol is precisely the unique nontrivial homomorphism — the quadratic character — and every deep theorem about residues (Euler's criterion, Gauss's lemma, reciprocity) is a statement about this character. Reciprocity itself is the assertion that a character mod , restricted to the prime , secretly carries the same arithmetic information as a character mod restricted to — a primordial instance of the duality at the heart of reciprocity laws.
Formal Statement
Quadratic Residue
Let be an odd prime and with . Then is a quadratic residue modulo if there exists with
Legendre Symbol
For an odd prime and integer , the Legendre symbol is
Here is the prime "modulus" and the "numerator"; the symbol depends only on . Symbols: = greatest common divisor; = multiplicative group of units; = field with elements.
Counting and Multiplicativity
Among the nonzero residues mod , exactly are QRs and are QNRs. The Legendre symbol is completely multiplicative:
Euler's Criterion
For odd prime and ,
Quadratic Reciprocity
For distinct odd primes ,
Why It Holds / Derivation
Euler's Criterion
Let be a primitive root mod , so is cyclic of order .
Step 1. Write . Then is a QR iff for some , i.e. iff is even, since the squares are exactly the elements of even index. Step 2. Compute . By Lagrange, has exact order , so has order , meaning . Step 3. Therefore . This equals iff is even (QR) and iff is odd (QNR), matching equation [2]. Since and are distinct mod (as is odd), the congruence determines the symbol exactly.Quadratic Reciprocity via Gauss's Lemma (sketch)
Step 1 — Gauss's Lemma. Fix coprime to and let . Reduce each () into the symmetric range and let be the number of negative reductions. Thenso .
Step 3 — Lattice-point symmetry (Eisenstein). The lattice points strictly inside the rectangle are split by the diagonal (no lattice point lies on it since ). Counting below the diagonal gives and above gives , hencewhich is equation [5].
Carl Friedrich Gauss | 1777–1855
Gauss discovered quadratic reciprocity at age 18 (1795) and gave the first complete proof in 1796, publishing it in the Disquisitiones Arithmeticae (1801). He prized the result so highly that he returned to it throughout his life, ultimately producing eight distinct proofs using induction, Gauss's lemma, Gauss sums, cyclotomy, and the theory of forms. His search for higher reciprocity laws (cubic, biquadratic) forced him to invent the Gaussian integers and launched algebraic number theory. The Legendre symbol's name honors Legendre, but its deepest structural theorem is irreducibly Gaussian.
Building Intuition
Think of as a clock with hours arranged in a circle, where "multiply by " rotates you one hour. Squaring doubles your hour-position, so you can only land on even hours — and those even hours are exactly the QRs. The Legendre symbol asks: "is your hour even or odd?" That parity question is preserved under multiplication (even+even=even, odd+odd=even), which is why the symbol is multiplicative.
Reciprocity is more startling. There's no obvious reason that the parity of 's position in 's clock should relate to the parity of 's position in 's clock — they are different clocks. Gauss's lattice-point proof reveals the hidden link: both parities are counting lattice points in the same rectangle, just split by its diagonal. The correction is simply "are both primes ?" — if so the symbols flip, otherwise they agree.
The squaring map on $(\mathbb{Z}/11\mathbb{Z})^\times$ folds the unit circle onto the QRs
Worked Examples
Is 30 a quadratic residue mod 53?
Given: (prime, ), . Step 1 — Factor and use multiplicativity [3]: , soFind a square root of 7 mod 23 using Euler's criterion
Given: , . Step 1 — Confirm is a QR via [4]: Compute . Successively: , , , so .Wait — that yields , so would be a nonresidue. Recheck: ; . Indeed , so no square root exists. Replace target by .
Step 2 — Test : , so by [6]: a root exists. Step 3 — Extract root (Tonelli for ): when , a root of a QR is . Here , so . Step 4 — Verify: , so . ✓Common Misconceptions
The Legendre symbol is not a fraction. is a multiplicative symbol, not division; but it is NOT "two thirds" of anything. " tells you the square root." It only certifies existence, not a value. Extracting the root (the Tonelli–Shanks algorithm) is a separate, harder task — though still polynomial time. Multiplicativity is in the numerator only. as Legendre symbols (the right side isn't even defined for composite ); the analogous denominator multiplicativity belongs to the Jacobi Symbol, whose value does not imply is a QR. Jacobi symbol does not mean quadratic residue. Take and . The Jacobi symbol factors asConnections
The Legendre symbol is the quadratic case of a vast hierarchy. Replacing the prime modulus by a composite gives the Jacobi Symbol (still multiplicative, computable without factoring); extending to all of and beyond gives the Hilbert Symbol and the Power Residue Symbol. Euler's criterion realizes the symbol as the unique quadratic Dirichlet Character mod , linking residues to L-functions and Dirichlet Series via for the Kronecker symbol . Quadratic reciprocity is the abelian, degree-2 shadow of Class Field Theory and ultimately the Artin Reciprocity Law; Gauss's sum-based proof connects it to Cyclotomic Fields and Gauss Sums. The count of QRs and the distribution of feed directly into Character Sums and the Pólya–Vinogradov Inequality.
Real-World Applications
- Solovay–Strassen primality test: uses the Jacobi symbol and Euler's criterion to probabilistically certify primality — historically central to RSA key generation.
- Tonelli–Shanks square-root extraction: computing square roots mod underpins decompression of elliptic-curve points (from to ) in protocols like ECDSA and EdDSA.
- Goldwasser–Micali cryptosystem: the first probabilistic public-key scheme, whose semantic security rests on the quadratic residuosity problem — distinguishing QRs from QNRs mod a composite without its factorization.
- Rabin cryptosystem: encryption is squaring mod ; decryption requires square roots mod and combined by CRT, with security provably equivalent to factoring.
- Paillier and Cocks identity-based encryption: Cocks's IBE scheme manipulates Jacobi symbols of ciphertext components.
- Quadratic-residue (QR) error-correcting codes: a class of cyclic codes (including the binary Golay code as a special case) whose defining set is the QRs mod a prime.
- Pseudorandom generators: the Blum–Blum–Shub generator iterates , with output bits secured by quadratic residuosity.
Historical Development
- 1640s — Fermat states results on which primes are sums of two squares, implicitly governed by .
- 1750s — Euler conjectures the reciprocity relation in the language of which primes divide values of quadratic forms, and proves Euler's criterion.
- 1785 — Legendre states the law of quadratic reciprocity and introduces the symbol notation, but his proofs assume the existence of primes in arithmetic progressions (then unproven), leaving gaps.
- 1796 — Gauss, aged 18, gives the first rigorous and complete proof (his "first proof," by induction).
- 1801 — Publication of Disquisitiones Arithmeticae, presenting the theorema aureum with multiple proofs and the full theory of forms.
- 1808–1832 — Gauss develops further proofs, including those via Gauss sums and biquadratic reciprocity over .
- 1844–1850 — Eisenstein gives elegant lattice-point and trigonometric proofs; Eisenstein and Jacobi establish cubic and quartic reciprocity.
- 1882 — Kronecker and Weber extend the symbol (Kronecker symbol) and frame reciprocity within cyclotomic theory.
- 1927 — Emil Artin proves the Artin reciprocity law, subsuming quadratic reciprocity as the simplest abelian case and crowning class field theory.