maths.freeNumber Theory › Congruences › Quadratic reciprocity

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.

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

\(\left(\frac{q}{p}\right) =\begin{cases} 1 & \text{if } n^2 \equiv q \pmod p \text{ for some integer } n\\ -1 & \text{otherwise}. \end{cases}\)

Then

\(\left(\frac{p}{q}\right) \left(\frac{q}{p}\right) = (-1)^{\frac{p-1}{2}\frac{q-1}{2}}.\)

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 \(x^2\equiv a \pmod p\) 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\equiv 3 \pmod 4\) using Euler's criterion one can give an explicit formula for the "square roots" modulo \(p\) of a quadratic residue \(a\), namely,

\(\pm a^{\frac{p+1}{4}}\)

indeed,

\(\left (\pm a^{\frac{p+1}{4}} \right )^2=a^{\frac{p+1}{2}}=a\cdot a^{\frac{p-1}{2}}\equiv a\left(\frac{a}{p}\right)=a \pmod p.\)

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) = n^2 - 5\) and its values for \(n \in \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 \(n^2-5\) whenever \(n^2 - 5 \equiv 0 \pmod p\), i.e. whenever \(n^2 \equiv 5 \pmod p,\) i.e. whenever 5 is a quadratic residue modulo \(p\). This happens for \(p= 2, 5\) and those primes with \(p\equiv 1, 4 \pmod 5,\) and the latter numbers \(1=(\pm1)^2\) and \(4=(\pm2)^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)=n^2 - 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 am (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.

Supplements to quadratic reciprocity

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.

q = ±1 and the first supplement

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.

First Supplement to Quadratic Reciprocity. The congruence \(x^2 \equiv -1 \pmod{p}\) is solvable if and only if \(p\) is congruent to 1 modulo 4.

q = ±2 and the second supplement

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

Second Supplement to Quadratic Reciprocity. The congruence \(x^2 \equiv 2 \pmod{p}\) is solvable if and only if \(p\) is congruent to ±1 modulo 8.

−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).

q = ±3

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.

q = ±5

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).

Higher q

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.

Example. For −5 to be a residue (mod p), either both 5 and −1 have to be residues (mod p) or they both have to be non-residues: i.e., p ≡ ±1 (mod 5) and p ≡ 1 (mod 4) or p ≡ ±2 (mod 5) and p ≡ 3 (mod 4). Using the Chinese remainder theorem these are equivalent to p ≡ 1, 9 (mod 20) or p ≡ 3, 7 (mod 20).

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

Statement of the theorem

Quadratic Reciprocity (Gauss's statement). If \(q \equiv 1 \pmod{4}\), then the congruence \(x^2 \equiv p \pmod{q}\) is solvable if and only if \(x^2 \equiv q \pmod{p}\) is solvable. If \(q \equiv 3 \pmod{4}\) and \(p \equiv 3 \pmod{4}\), then the congruence \(x^2 \equiv p \pmod{q}\) is solvable if and only if \(x^2 \equiv -q \pmod{p}\) is solvable.

Quadratic Reciprocity (combined statement). Define \(q^* = (-1)^{\frac{q-1}{2}}q\). Then the congruence \(x^2 \equiv p \pmod{q}\) is solvable if and only if \(x^2 \equiv q^* \pmod{p}\) is solvable.

Quadratic Reciprocity (Legendre's statement). If p or q are congruent to 1 modulo 4, then: \(x^2 \equiv q \pmod{p}\) is solvable if and only if \(x^2 \equiv p \pmod{q}\) is solvable. If p and q are congruent to 3 modulo 4, then: \(x^2 \equiv q \pmod{p}\) is solvable if and only if \(x^2 \equiv p \pmod{q}\) is not solvable.

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.

Proofs of the supplements

The value of the Legendre symbol of \(-1\) (used in the proof above) follows directly from Euler's criterion:

\(\left(\frac{-1}{p}\right)\equiv (-1)^{\frac{p-1}{2}} \pmod p\)

by Euler's criterion, but both sides of this congruence are numbers of the form \(\pm 1\), so they must be equal.

Whether \(2\) is a quadratic residue can be concluded if we know the number of solutions of the equation \(x^2+y^2=2\) with \(x, y \in \Z_p,\) which can be solved by standard methods. Namely, all its solutions where \(xy\neq 0, x\neq\pm y\) can be grouped into octuplets of the form \((\pm x, \pm y), (\pm y, \pm x)\), and what is left are four solutions of the form \((\pm 1, \pm 1)\) and possibly four additional solutions where \(x^2=2, y=0\) and \(x=0, y^2=2\), which exist precisely if \(2\) is a quadratic residue. That is, \(2\) is a quadratic residue precisely if the number of solutions of this equation is divisible by \(8\). And this equation can be solved in just the same way here as over the rational numbers: substitute \(x=a+1, y=at+1\), where we demand that \(a\neq 0\) (leaving out the two solutions \((1,\pm 1)\)), then the original equation transforms into

\(a=-\frac{2(t+1)}{(t^2+1)}.\)

Here \(t\) can have any value that does not make the denominator zero, for which there are \(1+\left(\frac{-1}{p}\right)\) possibilities (i.e. \(2\) if \(-1\) is a residue, \(0\) if not), and also does not make \(a\) zero, which excludes one more option, \(t=-1\). Thus there are

\(p-\left(1+\left(\frac{-1}{p}\right)\right)-1\)

possibilities for \(t\), and so together with the two excluded solutions there are overall \(p-\left(\frac{-1}{p}\right)\) solutions of the original equation. Therefore, \(2\) is a residue modulo \(p\) if and only if \(8\) divides \(p-(-1)^{\frac{p-1}{2}}\). This is a reformulation of the condition stated above.

History and alternative statements

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.

አሁን ምንም ዓይነት መሳሪያ ይህን አይቆጣጠርም፤ ነገር ግን ክፍሎቹ ሊቆጠሩ ይችላሉ። በታች ያለውን ይሞክሩ ወይም የራሳችሁን ይጻፉ።

የራስዎን ስራዎች ይያዙ

ነጻ የሆኑት መተግበሪያዎች በየክፍል ውስጥ ማስታወሻዎችን ያካትታሉ፣ የተጠናቀቁትን ነገሮች መዝገብ፣ የተፈቱ ችግሮችን በአንድ ቦታ፣ ስለዚህ ገጽ መጠየቅ የሚችሉትን ረዳት ያካትታሉ፡፡ የቁጥር ትምህርት ለሁሉም ሰው ክፍት ነው፣ ተቀባይነት ያለው ወይም የለም፤

ምዝገባ መግባቱ

ፊደላት

ለሙሉ መግለጫ፣ ምስል፣ እና በውስጡ ያለውን ፊደል ትርጓሜ ለማየት ማንኛውንም ምልክት ይጫኑ።

ጥያቄዎች

Why are primes so important?

Every integer factors into primes in exactly one way, so primes are the atoms of multiplication. Cryptography relies on that factoring being easy to state and hard to do.

How do I tell whether a big number is prime?

Trial division up to the square root works for small numbers. For large ones, probabilistic tests (Miller-Rabin) give an answer that is wrong with negligible probability, and deterministic tests (AKS) exist but are slower.

የዚህ ገጽ ክፍሎች ከ Wikipedia (CC BY-SA 4.0). እዚህ የተቀረጸና የተተረጎመ፤ ስህተቶች የእኛ ናቸው፡፡

በ Number Theory