MaVS

Reciprocity

Lesson
Visual

Quadratic Reciprocity

In this lesson, reciprocity refers to the concept of generalizing quadratic reciprocity. Quadratic reciprocity is the study of perfect square residues. It asks when these perfect squares exist and what they are. The law of quadratic reciprocity gives conditions for some residue aa mod nn to have a square root, or a number bb mod nn such that b2ab^2 \equiv a mod nn. Hence kk-th reciprocity is the property of aa having a kk-th root. In other words, some number bb such that bkab^k \equiv a mod nn.

Example: 00 and 11 always have kk-th roots mod nn for any k,nZk,n \in \Z because 0k00^k \equiv 0 and 1k11^k \equiv 1 mod nn.

But do kk-th roots exist for all remainders and all moduli? The answer is no! The following visualization demonstrates the numbers in the range of the function xkx^k mod nn for a given exponent kk and modulus nn. If a number aa is in the range of the function, that means it has a kk-th root mod nn, and the roots are the points that map to aa.

Example: 00, 11, and 44 are the only numbers with square roots mod 55. Using the visual, are there any solutions to x24x^2 \equiv 4 mod 55? What are they and how do you know?
 Modulus:

Legendre Symbols

As it turns out, there exists a formula to determine whether or not a number is a quadratic residue modulo some number nn. This formula starts by finding the prime decomposition of nn and determining whether or not a number is a quadratic residue modulo pp for some prime pp dividing nn.

To do this, we use the language of Legendre symbols: for all integers aa and odd primes pp,

(ap)={0if a0 mod p1if a≢0 mod p and   x:x2a mod p1if a≢0 mod p and there is no such x.\Big( \frac{a}{p} \Big) = \begin{cases} 0 &\text{if } a \equiv 0 \text{ mod } p \\ 1 &\text{if } a \not\equiv 0 \text{ mod } p \text{ and } \exists \; x : x^2 \equiv a \text{ mod } p \\ -1 &\text{if } a \not\equiv 0 \text{ mod } p \text{ and there is no such } x \end{cases}.

In other words, for nonzero aa, (ap)=1\big( \frac{a}{p} \big)=1 means that aa is a quadratic residue mod pp. Similarly, (ap)=1\big( \frac{a}{p} \big)=-1 means that aa is not a quadratic residue mod pp. In this case, we call aa either a quadratic non-residue or a non-quadratic residue.

As with the previous example, (05)=0\big( \frac{0}{5} \big)=0. Since 11 and 44 are quadratic residues mod 55, (15)=(45)=1\big( \frac{1}{5} \big)=\big( \frac{4}{5} \big)=1. Since 22 and 33 are quadratic non-residues mod 55, (25)=(35)=1\big( \frac{2}{5} \big)=\big( \frac{3}{5} \big)=-1.

Euler's Criterion

We can derive Euler's criterion to determine whether aa is a quadratic residue modulo pp:

ap12(ap) mod p.a^{\frac{p-1}{2}} \equiv \Big( \frac{a}{p} \Big) \text{ mod } p.

Using this formula, we can determine if aa is a quadratic residue mod pp in two steps: first, compute ap12a^{\frac{p-1}{2}} mod pp, and then check whether it equals 11 or 1-1.

The following visual only allows for you to enter a prime modulus pp. The mapping is from a remainder aa to ap12a^{\frac{p-1}{2}} mod pp. If the arrow is on 11, the remainder aa is a quadratic residue mod pp. If the arrow is on 1-1, the number is a quadratic non-residue mod pp.

 Modulus:
5
 Number to map:

Quadratic Reciprocity Law

Finally, we arrive at the quadratic reciprocity law: for any distinct odd primes pp and qq,

(pq)(qp)=(1)p12q12.\Big( \frac{p}{q} \Big) \Big( \frac{q}{p} \Big) = (-1)^{\frac{p-1}{2} \frac{q-1}{2}}.

This result allows us to switch the order of Legendre symbols and introduces a parity condition based on the primes themselves. If one of the primes is congruent to 11 modulo 44, we have (pq)=(qp)\big( \frac{p}{q} \big) = \big( \frac{q}{p} \big). If both of the primes are congruent to 33 modulo 44, we have (pq)=(qp)\big( \frac{p}{q} \big) = -\big( \frac{q}{p} \big). This dictates whether or not the number is a quadratic residue.

Example: we already saw that (35)=1\big( \frac{3}{5} \big)=-1. How can we determine (53)\big( \frac{5}{3} \big)?
  1. Since 515 \equiv 1 mod 44, we automatically know (35)=(53)=1\big( \frac{3}{5} \big)=\big( \frac{5}{3} \big)=-1
  2. If we do it brute-force, notice 525 \equiv 2 mod 33 and reduce (53)\big( \frac{5}{3} \big) to (23)\big( \frac{2}{3} \big)
  3. Check 02,12,0^2, 1^2, and 222^2 to see that 22 is a quadratic non-residue mod 33. So, (23)=1\big( \frac{2}{3} \big)=-1

Using the quadratic reciprocity law and the supplementary laws for the Legendre symbol, we can determine whether aa is a quadratic residue modulo any odd prime pp. Try it yourself. You can even change the exponent to check cubic reciprocity, quartic reciprocity, and more.

 Modulus:
 Exponential mapping: