Lecture 21 - Proving Quadratic Reciprocity

# Summary

Today we proved Quadratic Reciprocity. We started by developing a cousin to Gauss' Lemma that's called Eisenstein's Lemma, and then used this lemma — together with a geometric argument — to verify the quadratic reciprocity law.

To prove quadratic reciprocity, we need a preliminary lemma.

Lemma (Eisenstein): Suppose that p is an odd prime and that $p \nmid a$, where a is an odd number. Then for

$\displaystyle N = \sum_{i=1}^{\frac{p-1}{2}}\left\lfloor \frac{ia}{p}\right\rfloor$

we have

$\displaystyle \left(\frac{a}{p}\right) = (-1)^N$

#### Example: Using Eisenstein's Lemma

Before we prove Eisenstein's Lemma, let's see an example in action. Suppose want to compute $\left(\frac{7}{11}\right)$. Eisenstein says that with

(1)
\begin{align} N = \sum_{i=1}^{\frac{11-1}{2}} \left\lfloor \frac{7i}{11}\right\rfloor \end{align}

we have

(2)
\begin{align} \left(\frac{7}{11}\right) = (-1)^N. \end{align}

So let's compute N:

(3)
\begin{split} N &= \sum_{i=1}^{\frac{11-1}{2}} \left\lfloor \frac{7i}{11}\right\rfloor = \sum_{i=1}^{\frac{11-1}{2}} \left\lfloor \frac{7i}{11}\right\rfloor \\&= \left\lfloor \frac{7}{11}\right\rfloor+\left\lfloor \frac{14}{11}\right\rfloor+\left\lfloor \frac{21}{11}\right\rfloor+\left\lfloor \frac{28}{11}\right\rfloor+\left\lfloor \frac{35}{11}\right\rfloor = 0+1+1+2+3 = 7. \end{split}

Hence we conclude

(4)
\begin{align} \left(\frac{7}{11}\right) = (-1)^{7} = -1. \end{align}

$\square$

Now that we've seen this lemma used, let's see a proof of how it works. Our strategy will be to show that in fact we have $n \equiv N \mod{2}$, where n is the same same number we had in Gauss' Lemma (go back to remind yourself what this number is!). Once we have this, we know from Gauss' lemma that

(5)
\begin{align} \left(\frac{a}{p}\right) = (-1)^n, \end{align}

and since $n \equiv N \mod{2}$, we can conclude that

(6)
\begin{align} \left(\frac{a}{p}\right) = (-1)^n = (-1)^N. \end{align}

Proof: The proof of this result will be very similar to the proof of Gauss' Lemma. To start, we notice that for any $1 \leq i \leq \frac{p-1}{2}$ the division algorithm says

(7)
\begin{align} ia = p\cdot k_i + t_i, \end{align}

where $t_i$ is some remainder between 0 and $p-1$. Now we'll label the remainder for each ia as we did in our proof of Gauss' Lemma: if the remainder is greater than $\frac{p}{2}$ we'll denote it as $r_j$, and if the remainder is smaller than $\frac{p}{2}$ we'll label it as $s_j$. In either case, the integer k in the equation above is $\lfloor \frac{ia}{p}.$ From all of this, we get that

(8)
\begin{align} \sum_{i=1}^{\frac{p-1}{2}} ia = \sum_{i=1}^{\frac{p-1}{2}} p\left\lfloor \frac{ia}{p}\right\rfloor + t_i = \left(\sum_{i=1}^{\frac{p-1}{2}}p\left\lfloor \frac{ia}{p}\right\rfloor\right) + \left(\sum_{j=1}^n r_j + \sum_{j=1}^m s_j\right). \end{align}

Now recall from the proof of Gauss' Lemma that the set

(9)
\begin{align} p-r_1,p-r_2,\cdots,p-r_n,s_1,\cdots,s_m \end{align}

is the same as the set

(10)
\begin{align} 1,2,\cdots,\frac{p-1}{2}. \end{align}

So this means that

(11)
\begin{align} \sum_{i=1}^{\frac{p-1}{2}} i = \sum_{j=1}^n (p-r_n) + \sum_{j=1}^m s_j = pn - \sum_{j=1}^nr_n + \sum_{j=1}^m s_j. \end{align}

Now that we have Equations (8) and (11), we're going to subtract them from each other. On the left hand side, this gives

(12)
\begin{align} \sum_{i=1}^{\frac{p-1}{2}} ia - \sum_{i=1}^{\frac{p-1}{2}} i = (a-1)\left(\sum_{i=1}^{\frac{p-1}{2}} i \right). \end{align}

On the right hand side of the equation, we get

(13)
\begin{split} &\left(\sum_{i=1}^{\frac{p-1}{2}}p\left\lfloor \frac{ia}{p}\right\rfloor\right) + \left(\sum_{j=1}^n r_j + \sum_{j=1}^m s_j\right) - \left(pn - \sum_{j=1}^nr_n + \sum_{j=1}^m s_j\right)\\&= p\left(\sum_{i=1}^{\frac{p-1}{2}}\left\lfloor \frac{ia}{p}\right\rfloor\right) -pn + 2\sum_{j=1}^n r_n. \end{split}

Now let's reduce both sides mod 2. On the left hand side, since a is odd by assumption, we get that a-1 is even, and so the left hand side is 0 mod 2. On the right hand side, since p is odd we get that $p \equiv 1 \mod{2}$. The last sum drops out (since it's multiplied by 2), and so we get

(14)
\begin{align} 0 \equiv \left(\sum_{i=1}^{\frac{p-1}{2}}\left\lfloor \frac{ia}{p}\right\rfloor\right) -n \mod{2}. \end{align}

Therefore we have n and $N = \sum_{i=1}^{\frac{p-1}{2}}\left\lfloor \frac{ia}{p}\right\rfloor$ are the same mod 2, and so

(15)
\begin{align} (-1)^N = (-1)^n = \left(\frac{a}{p}\right). \end{align}

$\square$

Theorem (Quadratic Reciprocity): Suppose that p and q are distinct odd prime numbers. Then we have

$\displaystyle \left(\frac{p}{q}\right)\left(\frac{q}{p}\right) = (-1)^{\left(\frac{p-1}{2}\right)\left(\frac{q-1}{2}\right)} = \left\{\begin{array}{rl}1,&\mbox{ if }p \equiv 1 \mod{4} \mbox{ or } q \equiv 1 \mod{4}\\-1,&\mbox{ if }p \equiv q \equiv 3 \mod{4}.\end{array}\right.$

Our proof technique will be a little unusual. Basically, we'll use geometry to prove that the quantity

(16)
\begin{align} \frac{p-1}{2}\frac{q-1}{2}= \sum_{y_0=1}^{\frac{q-1}{2}} \left\lfloor \frac{py_0}{q}\right\rfloor + \sum_{x_0=1}^{\frac{p-1}{2}} \left\lfloor \frac{qx_0}{p}\right\rfloor. \end{align}

Why is this important? Well, Eisenstein's Lemma says that

(17)
\begin{split} \left(\frac{q}{p}\right) &= (-1)^{\sum_{y_0=1}^{\frac{p-1}{2}} \left\lfloor \frac{qy_0}{p}\right\rfloor}\\ &\mbox{ and }\\ \left(\frac{p}{q}\right) &= (-1)^{\sum_{x_0=1}^{\frac{q-1}{2}} \left\lfloor \frac{px_0}{q}\right\rfloor}. \end{split}

Hence if we can prove Equation (16), then we'll know

(18)
\begin{split} \left(\frac{q}{p}\right)\left(\frac{p}{q}\right) &= (-1)^{\sum_{y_0=1}^{\frac{p-1}{2}} \left\lfloor \frac{qy_0}{p}\right\rfloor}(-1)^{\sum_{x_0=1}^{\frac{q-1}{2}} \left\lfloor \frac{px_0}{q}\right\rfloor}\\ &= (-1)^{\sum_{y_0=1}^{\frac{p-1}{2}} \left\lfloor \frac{qy_0}{p}\right\rfloor+\sum_{x_0=1}^{\frac{q-1}{2}} \left\lfloor \frac{px_0}{q}\right\rfloor}\\ &=(-1)^{\frac{q-1}{2}\frac{p-1}{2}}, \end{split}

which is exactly what we want to prove.

Proposition: For distinct odd primes p and q, Equation (16) is true.

Proof:

Our technique will be to use geometry to equate these two quantities. We'll start by drawing a grid that is $\frac{p}{2}$ units long and $\frac{q}{2}$ units tall. Here's a picture of the grid:

Now we'll show both sides of Equation (16) are the same by showing that each side of the equation represents a distinct way of counting the lattice points inside the same region. The lattice points are those points where both the x- and y-coordinates are integers, except that we won't count lattice points that are 0 in either the x- or y-coordinate.

Now on the one hand, the number of lattice points in this rectangle is clearly

(19)
\begin{align} \frac{p-1}{2}\frac{q-1}{2}, \end{align}

since these lattice points $(x,y)$ have integer x-coordinates that are between 1 and $\frac{q-1}{2}$ and integer y-coordinates that are between 1 and $\frac{p-1}{2}$. Since the choice of x- and y-coordinate can be made independently, this means that we have $\frac{p-1}{2}\frac{q-1}{2}$ in this rectangle.

Now we'll count these points another way, by splitting the rectangle up into two triangles and counting the number of lattice points in each triangle individually.

In this case, the total number of lattice points will be the total number of lattice points in the top triangle plus the total number of lattice points in the bottom triangle. Notice that we don't have to worry about any lattice points being in both triangles, since such a point would have to lie on the boundary between the triangles, which is the line $y = \frac{p}{q}x$. Of course there are no solutions to this equation where $1 \leq x \leq \frac{q-1}{2}$ since q is a prime number (and we'd need x to be a multiple of q in order to get the cancellation we need for y to be an integer.

So, let's proceed to count the lattice points in the triangles below.

#### Points in the top triangle

We'll first count the lattice points in the top triangle. For this, let's choose an integer y-coordinate $y_0$ and find all lattice points that have $y_0$ as their y-coordinate and which sit inside the top triangle. Notice that the diagonal for the rectangle has equation

(20)
\begin{align} y=\frac{p}{q}x \Leftrightarrow x = \frac{q}{p}y. \end{align}

Hence the line $y=y_0$ intersects this diagonal at the point

(21)
\begin{align} (\frac{q}{p}y_0,y_0). \end{align}

Hence we know that the possible x-coordinates for lattice points on the line $y=y_0$ must be integers x that satisfy $1 \leq x \leq \frac{q}{p}y_0$. Indeed, since p and q are distinct primes, we can in fact say that the possible x-coordinates are integers x that satisfy

(22)
\begin{align} 1 \leq x < \frac{q}{p}y_0. \end{align}

There are $\left\lfloor \frac{qy_0}{p}\right\rfloor$ such integers x, and hence this many lattice points along the line $y=y_0$ inside the red triangle.

The total number of lattice points in the red triangle, then, is the number of lattice points across each such line, where the lines range over integers $y_0$ between 1 and $\frac{p-1}{2}$. Hence the number of lattice points for the red triangle is

(23)
\begin{align} \sum_{y_0=1}^{\frac{p-1}{2}} \left\lfloor \frac{qy_0}{p}\right\rfloor. \end{align}

#### Points in bottom triangle

How many lattice points are in the bottom triangle? The same style of argument as above will work. For each integer x-coordinate $x_0$, we'll find all the lattice points that have $x_0$ as their x-coordinate and which sit inside the bottom triangle. Then we'll add up all the lattice points from these various vertical lines.

Since the diagonal for the rectangle has equation

(24)
\begin{align} y=\frac{p}{q}x, \end{align}

the line $x=x_0$ intersects this diagonal at the point

(25)
\begin{align} (x_0,\frac{p}{q}x_0). \end{align}

Hence we know that the possible y-coordinates for lattice points on the line $x=x_0$ must be integers y that satisfy $1 \leq y \leq \frac{p}{q}x_0$. Indeed, since p and q are distinct primes, we can in fact say that the possible y-coordinates are integers y that satisfy

(26)
\begin{align} 1 \leq y < \frac{p}{q}x_0. \end{align}

There are $\left\lfloor \frac{px_0}{q}\right\rfloor$ such integers y, and hence this many lattice points along the line $x=x_0$ inside the bottom triangle.

The total number of lattice points in the bottom triangle, then, is the number of lattice points across each such vertical line, where the lines range over integers $x_0$ between 1 and $\frac{q-1}{2}$. Hence the number of lattice points for the bottom triangle is

(27)
\begin{align} \sum_{x_0=1}^{\frac{q-1}{2}} \left\lfloor \frac{px_0}{q}\right\rfloor. \end{align}

$\square$

This proof requires some careful thinking to fully understand, and it's not the kind of thing I'd be expecting you to repeat on a test or come up with by yourself. However, you should spend some time trying to digest how this proof works. You should also spend time reviewing the power of the theorem that it proves; quadratic reciprocity is one of the most beautiful theorems we'll get a chance to talk about in this class, and it can be used to solve a whole host of problems which would otherwise be impossible to approach.