On this page
Pick two odd primes, say 3 and 11. Asking whether 3 is a perfect square in arithmetic mod 11, and whether 11 is a perfect square mod 3, looks like two separate questions. The law of quadratic reciprocity says they are tied together by one sign, and that sign turns a long search into a few lines of working.
What is the law of quadratic reciprocity?
First, the words. A number a is a quadratic residue mod p if some whole number x has x² ≡ a (mod p); if a is not divisible by p and no such x exists, a is a non-residue. The Legendre symbol (a/p) records the answer: +1 for a residue, −1 for a non-residue. If these ideas are new, start with our explainer on quadratic residues and the Legendre symbol.
For distinct odd primes p and q, the law states that (p/q)(q/p) = (−1)^((p−1)(q−1)/4), as set out on Wikipedia's quadratic reciprocity page.
In words: the two answers agree, unless both p and q are 3 mod 4, in which case they are opposite. You can see why from the exponent. (p−1)(q−1)/4 equals ((p−1)/2) × ((q−1)/2), and that product is odd only when both halves are odd, which happens exactly when p ≡ 3 and q ≡ 3 (mod 4).
How do you check if 3 is a square mod 11?
Both 3 and 11 are 3 mod 4. The exponent is (2 × 10)/4 = 5, which is odd, so (3/11) = −(11/3).
Reduce the top: 11 ≡ 2 (mod 3), so (11/3) = (2/3).
The squares mod 3 are 0 and 1, so 2 is not one: (2/3) = −1.
So (3/11) = −(−1) = +1. Yes, 3 is a square mod 11.
Check by hand: 5² = 25 = 2 × 11 + 3. It works.
Is 13 a square mod 17?
13 is 1 mod 4, so the exponent (12 × 16)/4 = 48 is even and there is no sign change: (13/17) = (17/13).
Reduce: 17 ≡ 4 (mod 13), so (17/13) = (4/13).
4 = 2², a square, so (4/13) = +1.
So 13 is a square mod 17. Check: 8² = 64 = 3 × 17 + 13.
What are the supplementary laws for −1 and 2?
Factoring leaves two pieces the main law cannot flip: −1 and 2. The supplementary laws, stated on Wikipedia's quadratic reciprocity page, handle them.
First supplement: x² ≡ −1 (mod p) has a solution exactly when p ≡ 1 (mod 4). Example: p = 13, and 5² = 25 ≡ −1 (mod 13).
Second supplement: x² ≡ 2 (mod p) has a solution exactly when p ≡ ±1 (mod 8). Example: p = 7, and 3² = 9 ≡ 2 (mod 7). For p = 11, which is 3 mod 8, the squares are only 1, 3, 4, 5 and 9, so 2 is missing.
The first supplement is also the gate in Fermat's rule for which primes are a sum of two squares: apart from 2 = 1² + 1², only primes that are 1 mod 4 can be written as a² + b².
Who proved quadratic reciprocity, and how many proofs did Gauss give?
According to Wikipedia's history of the theorem, the law was conjectured by Leonhard Euler and Adrien-Marie Legendre and first proved by Carl Friedrich Gauss. Gauss published his first and second proofs in the Disquisitiones Arithmeticae in 1801. He called it the fundamental theorem in print and, privately, the golden theorem. He published six proofs, and two more were found in his papers after his death, which makes eight. The same page says there are now over 240 published proofs.
The MacTutor biography of Gauss says he found the law independently while still a student at the Collegium Carolinum in Brunswick, and published the Disquisitiones Arithmeticae in the summer of 1801.
The squares mod a prime have another description too: they are exactly the even powers of a primitive root, which our post on primitive roots modulo a prime works through for 7.
How should you practise quadratic reciprocity?
Use this order on any symbol (a/p):
Reduce a mod p, and pull out any square factors, which contribute +1.
Split off −1 and 2 and settle them with the supplementary laws.
For each odd prime factor q, flip (q/p) to (p/q), with a minus sign only if both are 3 mod 4.
Repeat until every symbol has a small top you can read off.
When p is small, confirm the answer by finding an x with x² ≡ a.
Try it on (5/19), (7/23) and (10/31) before looking anything up. If a step trips you up, the Fermi Problem Library has a step-by-step solver that explains the reasoning rather than printing an answer, and the Fermi Concept Library has a lesson on every concept in mathematics, so you can revisit the ideas underneath.



