# Quadratic reciprocity

In number theory, the **law of quadratic reciprocity** is a theorem about modular arithmetic that gives conditions for the solvability of quadratic equations modulo prime numbers. Due to its subtlety, it has many formulations, but the most standard statement is:

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

The quadratic reciprocity theorem was conjectured by Euler and Legendre and first proved by Gauss,^{[1]} 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.*

Privately, Gauss referred to it as the "golden theorem".^{[2]} He published six proofs for it, and two more were found in his posthumous papers. There are now over 240 published proofs.^{[3]} 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.

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

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:

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.

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.

Another way to organize the data is to see which primes are 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 supplements provide solutions to specific cases of quadratic reciprocity. They are often quoted as partial results, without having to resort to the complete theorem.

Trivially 1 is a quadratic residue for all primes. The question becomes more interesting for −1. Examining the table, we find −1 in rows 5, 13, 17, 29, 37, and 41 but not in rows 3, 7, 11, 19, 23, 31, 43 or 47. The former set of primes are all congruent to 1 modulo 4, and the latter are congruent to 3 modulo 4.

Examining the table, we find 2 in rows 7, 17, 23, 31, 41, and 47, but not in rows 3, 5, 11, 13, 19, 29, 37, or 43. The former primes are all ≡ ±1 (mod 8), and the latter are all ≡ ±3 (mod 8). This leads to

−2 is in rows 3, 11, 17, 19, 41, 43, but not in rows 5, 7, 13, 23, 29, 31, 37, or 47. The former are ≡ 1 or ≡ 3 (mod 8), and the latter are ≡ 5, 7 (mod 8).

3 is in rows 11, 13, 23, 37, and 47, but not in rows 5, 7, 17, 19, 29, 31, 41, or 43. The former are ≡ ±1 (mod 12) and the latter are all ≡ ±5 (mod 12).

−3 is in rows 7, 13, 19, 31, 37, and 43 but not in rows 5, 11, 17, 23, 29, 41, or 47. The former are ≡ 1 (mod 3) and the latter ≡ 2 (mod 3).

Since the only residue (mod 3) is 1, we see that −3 is a quadratic residue modulo every prime which is a residue modulo 3.

5 is in rows 11, 19, 29, 31, and 41 but not in rows 3, 7, 13, 17, 23, 37, 43, or 47. The former are ≡ ±1 (mod 5) and the latter are ≡ ±2 (mod 5).

Since the only residues (mod 5) are ±1, we see that 5 is a quadratic residue modulo every prime which is a residue modulo 5.

−5 is in rows 3, 7, 23, 29, 41, 43, and 47 but not in rows 11, 13, 17, 19, 31, or 37. The former are ≡ 1, 3, 7, 9 (mod 20) and the latter are ≡ 11, 13, 17, 19 (mod 20).

The observations about −3 and 5 continue to hold: −7 is a residue modulo *p* if and only if *p* is a residue modulo 7, −11 is a residue modulo *p* if and only if *p* is a residue modulo 11, 13 is a residue (mod *p*) if and only if *p* is a residue modulo 13, etc. The more complicated-looking rules for the quadratic characters of 3 and −5, which depend upon congruences modulo 12 and 20 respectively, are simply the ones for −3 and 5 working with the first supplement.

The generalization of the rules for −3 and 5 is Gauss's statement of quadratic reciprocity.

The last is immediately equivalent to the modern form stated in the introduction above. It is a simple exercise to prove that Legendre's and Gauss's statements are equivalent – it requires no more than the first supplement and the facts about multiplying residues and nonresidues.

Apparently, the shortest known proof yet was published by B. Veklych in the *American Mathematical Monthly*.^{[4]}

The theorem was formulated in many ways before its modern form: Euler and Legendre did not have Gauss's congruence notation, nor did Gauss have the Legendre symbol.

In this article *p* and *q* always refer to distinct positive odd primes, and *x* and *y* to unspecified integers.

Fermat proved^{[5]} (or claimed to have proved)^{[6]} a number of theorems about expressing a prime by a quadratic form:

He did not state the law of quadratic reciprocity, although the cases −1, ±2, and ±3 are easy deductions from these and other of his theorems.

He also claimed to have a proof that if the prime number *p* ends with 7, (in base 10) and the prime number *q* ends in 3, and *p* ≡ *q* ≡ 3 (mod 4), then

Proving these and other statements of Fermat was one of the things that led mathematicians to the reciprocity theorem.

Translated into modern notation, Euler stated ^{[8]} that for distinct odd primes *p* and *q*:

Thus if *p* does not divide *a*, using the non-obvious fact (see for example Ireland and Rosen below) that the residues modulo *p* form a field and therefore in particular the multiplicative group is cyclic, hence there can be at most two solutions to a quadratic equation:

Legendre^{[10]} lets *a* and *A* represent positive primes ≡ 1 (mod 4) and *b* and *B* positive primes ≡ 3 (mod 4), and sets out a table of eight theorems that together are equivalent to quadratic reciprocity:

This is now known as the Legendre symbol, and an equivalent^{[11]}^{[12]} definition is used today: for all integers *a* and all odd primes *p*

A number of proofs, especially those based on Gauss's Lemma,^{[13]} explicitly calculate this formula.

From these two supplements, we can obtain a third reciprocity law for the quadratic character -2 as follows:

This technique doesn't work for Theorem VIII. Let *b* ≡ *B* ≡ 3 (mod 4), and assume

Gauss first proves^{[14]} the supplementary laws. He sets^{[15]} the basis for induction by proving the theorem for ±3 and ±5. Noting^{[16]} that it is easier to state for −3 and +5 than it is for +3 or −5, he states^{[17]} the general theorem in the form:

Introducing the notation *a* R *b* (resp. *a* N *b*) to mean *a* is a quadratic residue (resp. nonresidue) (mod *b*), and letting *a*, *a*′, etc. represent positive primes ≡ 1 (mod 4) and *b*, *b*′, etc. positive primes ≡ 3 (mod 4), he breaks it out into the same 8 cases as Legendre:

In the next Article he generalizes this to what are basically the rules for the Jacobi symbol (below). Letting *A*, *A*′, etc. represent any (prime or composite) positive numbers ≡ 1 (mod 4) and *B*, *B*′, etc. positive numbers ≡ 3 (mod 4):

All of these cases take the form "if a prime is a residue (mod a composite), then the composite is a residue or nonresidue (mod the prime), depending on the congruences (mod 4)". He proves that these follow from cases 1) - 8).

Gauss needed, and was able to prove,^{[18]} a lemma similar to the one Legendre needed:

A number of proofs of the theorem, especially those based on Gauss sums derive this formula.^{[19]} or the splitting of primes in algebraic number fields,^{[20]}

The statements in this section are equivalent to quadratic reciprocity: if, for example, Euler's version is assumed, the Legendre-Gauss version can be deduced from it, and vice versa.

Gauss's fourth proof consists of proving this theorem (by comparing two formulas for the value of Gauss sums) and then restricting it to two primes. He then gives an example: Let *a* = 3, *b* = 5, *c* = 7, and *d* = 11. Three of these, 3, 7, and 11 ≡ 3 (mod 4), so *m* ≡ 3 (mod 4). 5×7×11 R 3; 3×7×11 R 5; 3×5×11 R 7; and 3×5×7 N 11, so there are an odd number of nonresidues.

The Jacobi symbol is a generalization of the Legendre symbol; the main difference is that the bottom number has to be positive and odd, but does not have to be prime. If it is prime, the two symbols agree. It obeys the same rules of manipulation as the Legendre symbol. In particular

and if both numbers are positive and odd (this is sometimes called "Jacobi's reciprocity law"):

However, if the Jacobi symbol is 1 but the denominator is not a prime, it does not necessarily follow that the numerator is a quadratic residue of the denominator. Gauss's cases 9) - 14) above can be expressed in terms of Jacobi symbols:

and since *p* is prime the left hand side is a Legendre symbol, and we know whether *M* is a residue modulo *p* or not.

The formulas listed in the preceding section are true for Jacobi symbols as long as the symbols are defined. Euler's formula may be written

Eisenstein's formula requires relative primality conditions (which are true if the numbers are prime)

The proof of Hilbert reciprocity reduces to checking a few special cases, and the non-trivial cases turn out to be equivalent to the main law and the two supplementary laws of quadratic reciprocity for the Legendre symbol. There is no kind of reciprocity in the Hilbert reciprocity law; its name simply indicates the historical source of the result in quadratic reciprocity. Unlike quadratic reciprocity, which requires sign conditions (namely positivity of the primes involved) and a special treatment of the prime 2, the Hilbert reciprocity law treats all absolute values of the rationals on an equal footing. Therefore, it is a more natural way of expressing quadratic reciprocity with a view towards generalization: the Hilbert reciprocity law extends with very few changes to all global fields and this extension can rightly be considered a generalization of quadratic reciprocity to all global fields.

The early proofs of quadratic reciprocity are relatively unilluminating. The situation changed when Gauss used Gauss sums to show that quadratic fields are subfields of cyclotomic fields, and implicitly deduced quadratic reciprocity from a reciprocity theorem for cyclotomic fields. His proof was cast in modern form by later algebraic number theorists. This proof served as a template for class field theory, which can be viewed as a vast generalization of quadratic reciprocity.

Robert Langlands formulated the Langlands program, which gives a conjectural vast generalization of class field theory. He wrote:^{[26]}

There are also quadratic reciprocity laws in rings other than the integers.

Let λ = *a* + *bω* and μ = *c* + *dω* be distinct Eisenstein primes where *a* and *c* are not divisible by 3 and *b* and *d* are divisible by 3. Eisenstein proved^{[32]}

The attempt to generalize quadratic reciprocity for powers higher than the second was one of the main goals that led 19th century mathematicians, including Carl Friedrich Gauss, Peter Gustav Lejeune Dirichlet, Carl Gustav Jakob Jacobi, Gotthold Eisenstein, Richard Dedekind, Ernst Kummer, and David Hilbert to the study of general algebraic number fields and their rings of integers;^{[36]} specifically Kummer invented ideals in order to state and prove higher reciprocity laws.

The ninth in the list of 23 unsolved problems which David Hilbert proposed to the Congress of Mathematicians in 1900 asked for the "Proof of the most general reciprocity law [f]or an arbitrary number field".^{[37]} Building upon work by Philipp Furtwängler, Teiji Takagi, Helmut Hasse and others, Emil Artin discovered Artin reciprocity in 1923, a general theorem for which all known reciprocity laws are special cases, and proved it in 1927.^{[38]}

The *Disquisitiones Arithmeticae* has been translated (from Latin) into English and German. The German edition includes all of Gauss's papers on number theory: all the proofs of quadratic reciprocity, the determination of the sign of the Gauss sum, the investigations into biquadratic reciprocity, and unpublished notes. Footnotes referencing the *Disquisitiones Arithmeticae* are of the form "Gauss, DA, Art. *n*".

The two monographs Gauss published on biquadratic reciprocity have consecutively numbered sections: the first contains §§ 1–23 and the second §§ 24–76. Footnotes referencing these are of the form "Gauss, BQ, § *n*".

These are in Gauss's *Werke*, Vol II, pp. 65–92 and 93–148. German translations are in pp. 511–533 and 534–586 of *Untersuchungen über höhere Arithmetik.*

Every textbook on elementary number theory (and quite a few on algebraic number theory) has a proof of quadratic reciprocity. Two are especially noteworthy:

Franz Lemmermeyer's *Reciprocity Laws: From Euler to Eisenstein* has *many* proofs (some in exercises) of both quadratic and higher-power reciprocity laws and a discussion of their history. Its immense bibliography includes literature citations for 196 different published proofs for the quadratic reciprocity law.

Kenneth Ireland and Michael Rosen's *A Classical Introduction to Modern Number Theory* also has many proofs of quadratic reciprocity (and many exercises), and covers the cubic and biquadratic cases as well. Exercise 13.26 (p. 202) says it all

Count the number of proofs to the law of quadratic reciprocity given thus far in this book and devise another one.