Lably
Skip to content

Quadratic reciprocity

Gives conditions for the solvability of quadratic equations modulo prime numbers

  • 21 min read
  • 8 chapters
Quadratic reciprocity
Unknown author · Public domain

Related on Lably

Through Modular arithmetic, Quadratic equation and Prime number

Law of quadratic reciprocity—Let p and q be distinct odd prime numbers, and define the Legendre symbol as

(qp)={1if n2≡q(modp) for some integer n−1otherwise.

Then

(pq)(qp)=(−1)p−12q−12.

This law, together with its supplements, allows the easy calculation of any Legendre symbol, making it possible to determine whether there is an integer solution for any quadratic equation of the form x2≡a(modp) for an odd prime p; that is, to determine the "perfect squares" modulo p. However, this is a non-constructive result: it gives no help at all for finding a specific solution; for this, other methods are required. For example, in the case p≡3(mod4) using Euler's criterion one can give an explicit formula for the "square roots" modulo p of a quadratic residue a, namely,

±ap+14

indeed,

(±ap+14)2=ap+12=a⋅ap−12≡a(ap)=a(modp).

This formula only works if it is known in advance that a is a quadratic residue, which can be checked using the law of quadratic reciprocity.

The quadratic reciprocity theorem was conjectured by Leonhard Euler and Adrien-Marie Legendre and first proved by Carl Friedrich Gauss, who referred to it as the "fundamental theorem" in his Disquisitiones Arithmeticae and his papers, writing

The fundamental theorem must certainly be regarded as one of the most elegant of its type. (Art. 151)

Privately, Gauss referred to it as the "golden theorem". He published six proofs for it, and two more were found in his posthumous papers. There are now over 240 published proofs. The shortest known proof is included below, together with short proofs of the law's supplements (the Legendre symbols of −1 and 2).

Generalizing the reciprocity law to higher powers has been a leading problem in mathematics, and has been crucial to the development of much of the machinery of modern algebra, number theory, and algebraic geometry, culminating in Artin reciprocity, class field theory, and the Langlands program.

Motivating examples

Quadratic reciprocity arises from certain subtle factorization patterns involving perfect square numbers. In this section, we give examples which lead to the general case.

Factoring n2 − 5

Consider the polynomial f(n)=n2−5 and its values for n∈N. The prime factorizations of these values are given as follows:

The prime factors p dividing f(n) are p=2,5, and every prime whose final digit is 1 or 9; no primes ending in 3 or 7 ever appear. Now, p is a prime factor of some n2−5 whenever n2−5≡0(modp), i.e. whenever n2≡5(modp), i.e. whenever 5 is a quadratic residue modulo p. This happens for p=2,5 and those primes with p≡1,4(mod5), and the latter numbers 1=(±1)2 and 4=(±2)2 are precisely the quadratic residues modulo 5. Therefore, except for p=2,5, we have that 5 is a quadratic residue modulo p iff p is a quadratic residue modulo 5.

The law of quadratic reciprocity gives a similar characterization of prime divisors of f(n)=n2−q for any prime q, which leads to a characterization for any integer q.

Patterns among quadratic residues

Let p be an odd prime. A number modulo p is a quadratic residue whenever it is congruent to a square (mod p); otherwise it is a quadratic non-residue. ("Quadratic" can be dropped if it is clear from the context.) Here we exclude zero as a special case. Then as a consequence of the fact that the multiplicative group of a finite field of order p is cyclic of order p-1, the following statements hold:

  • There are an equal number of quadratic residues and non-residues; and
  • The product of two quadratic residues is a residue, the product of a residue and a non-residue is a non-residue, and the product of two non-residues is a residue.

For the avoidance of doubt, these statements do not hold if the modulus is not prime. For example, there are only 3 quadratic residues (1, 4 and 9) in the multiplicative group modulo 15. Moreover, although 7 and 8 are quadratic non-residues, their product 7x8 = 11 is also a quadratic non-residue, in contrast to the prime case.

Quadratic residues appear as entries in the following table, indexed by the row number as modulus and column number as root:

This table is complete for odd primes less than 50. To check whether a number m is a quadratic residue mod one of these primes p, find a ≡ m (mod p) and 0 ≤ a < p. If a is in row p, then m is a residue (mod p); if a is not in row p of the table, then m is a nonresidue (mod p).

The quadratic reciprocity law is the statement that certain patterns found in the table are true in general.

Legendre's version

Another way to organize the data is to see which primes are quadratic residues mod which other primes, as illustrated in the following table. The entry in row p column q is R if q is a quadratic residue (mod p); if it is a nonresidue the entry is N.

If the row, or the column, or both, are ≡ 1 (mod 4) the entry is blue or green; if both row and column are ≡ 3 (mod 4), it is yellow or orange.

The blue and green entries are symmetric around the diagonal: The entry for row p, column q is R (resp N) if and only if the entry at row q, column p, is R (resp N).

The yellow and orange ones, on the other hand, are antisymmetric: The entry for row p, column q is R (resp N) if and only if the entry at row q, column p, is N (resp R).

The reciprocity law states that these patterns hold for all p and q.

Ordering the rows and columns mod 4 makes the pattern clearer.

Sign in to keep reading

7 more chapters are free with a Lably account.

More in Number theory