In this section, we'll begin our discussion of quadratic congruences.
The central result to come is called * Quadratic
Reciprocity*.

Gauss considered the proofs he gave of quadratic reciprocity one of his crowning achievements; in fact, he gave 6 distinct proofs during his lifetime. Reciprocity is a deep result: Proofs eluded both Euler and Legendre.

The reciprocity law is simple to state. For p and q odd primes, it relates solutions to the two congruences

(Note how p and q switch places: This explains why it's called a
*reciprocity* law.) The law of quadratic reciprocity says:

The congruences are either both solvable or both unsolvable, unless both primes are congruent to 3 mod 4. In that case, one is solvable while the other is not.

Gauss first gave a proof of this when he was 19!

Gauss's masterwork, the *Disquisitiones Arithmeticae*, was
published in 1801 when Gauss was 24. It changed the course of number
theory, collecting scattered results into a unified theory.

We'll look at some important computational devices before we consider reciprocity.

* Definition.* Let , . a is a *
quadratic residue* mod m if the following equation has a
solution:

Otherwise, a is a * quadratic nonresidue* mod m.

* Example.* (a) Is 8 a quadratic residue mod 17?

(b) Find all the quadratic residues mod 18.

(a) 8 is a quadratic residue mod 17, since .

(b) I list the elements in which are relatively prime to 18 and compute their squares mod 18:

The quadratic residues are the *squares*: that is, 1, 7, and
13.

Since , the second row of the table is symmetric left-to-right.

* Lemma.* Let p be an odd prime, and consider the
congruence

(a) The only solution is if .

(b) There are exactly 0 or 2 solutions if .

* Proof.* solves . Conversely, if , then , so , and hence .

Suppose . To show there are 0 or 2 solutions, suppose there is at least one solution b. Then , so . I claim that b and are distinct.

If not, then , so . p is an odd prime, so . Therefore, , , , and finally --- contradicting . Hence, .

Now I have two distinct solutions; since a quadratic equation mod p has at most two solutions (Prove it!), there are exactly two.

For example, has 5 and 12 as solutions, and .

On the other hand, you can check that the quadratic residues mod 17 are . Thus, has no solutions.

Note that the result is false if , since has exactly one solution: .

* Corollary.* Let p be an odd prime. There are
quadratic residues and quadratic nonresidues mod p in .

* Proof.* k and have the same square mod p. That is, 1 and have the same square, 2 and have the same square, ..., and and have
the same square.

Thus, the number of different squares is --- these squares are the quadratic residues, and the other numbers in are quadratic nonresidues.

* Definition.* Let p be an odd prime, and let
. The * Legendre
symbol* is defined by

Note that is disallowed (since ) even though has a solution.

As an easy example, , since . On the other hand, , because as I noted above has no solutions.

You might wonder about the case where , or the case where the modulus is composite. For , there are only two quadratic congruences:

These have the solutions and --- nothing much is going on.

If the modulus has prime factorization , then relative primality implies that it's enough to solve the congruences for each i. It turns out that solving such a congruence reduces to determining whether a is a quadratic residue mod . Therefore, there is little harm in concentrating on the case of a single prime.

* Example.* Solve the congruence

I'll solve the congruences

reduces to . Making a table of squares mod 7, I find that the solutions are and mod 7.

reduces to . The solutions are and mod 13.

I'll consider the possibilities, solving using the Chinese Remainder Theorem. But note that since , the solutions will come in pairs. So once I find a solution m, I know that is also a solution.

Consider

Then is another solution.

Consider

Then is another solution.

It's possible that the second computation might have given me 25, the solution I got earlier. In that case, I'd have to move on to one of the other two cases. I got lucky and had to only do two cases, instead of three.

Here are some tools for computing Legendre symbols.

* Theorem.* (Euler) Let p be an odd prime, , . Then

* Proof.* There are two cases. Suppose that . Then there is a number b such that . So

If , then , a contradiction. So , and Fermat's theorem implies that . So

The other possibility is . In this case, consider the set . I claim that these integers occur in pairs s, t, such that .

First, if , then s is invertible mod p. So I can write , and the pair s, , multiplies to a.

Moreover, s and are distinct. If not, , or , which contradicts .

Since the integers divide up into pairs, each multiplying to a, and since there are pairs, I have

By Wilson's theorem,

* Example.* Use Euler's formula to compute .

Hence, , and should have a solution. Indeed,

Euler's formula gives an expression for the Legendre symbol, but it becomes tedious to compute with it if the numbers are large. We'll see that you can use the properties of the Legendre symbol given below together with Quadratic Reciprocity to simplify computations.

* Proposition.* If , then .

* Proof.* If , then if and only if . Thus, one of these equations is solvable
or not solvable if and only if the same is true for the other ---
which means .

Note that I can use this result to apply Euler's formula to for by simply replacing a with such that .

* Proposition.* Let p be an odd prime, , . Then

* Proof.* By Euler's formula,

Therefore,

The two sides of this equation are . Since p is an odd prime, the two sides can't differ by 2. Hence, they must be equal as integers:

* Corollary.* Let p be an odd prime, , . Then

* Proof.*

You can use the results above to compute for specific values of a and arbitrary p.

* Proposition.* Let p be an odd prime. Then

* Proof.* By Euler's formula,

As examples, , because . Thus, has solutions. And in fact,

Likewise, , because . Hence, has no solutions.

Using Gauss's lemma, which I'll prove shortly, you can also show that

Note that is actually an integer: Since , I have . And is divisible by 8, because one of k, , must be even.

So, for example,

Therefore, has solutions. works, for instance.

Copyright 2019 by Bruce Ikenaga