# Summary

In today's class we began by reviewing the criteria we saw for evaluating Legendre symbols last class period, particularly when the "numerator" was either -1 or 2. Afterwards we set to proving

(1)This required Gauss' Lemma, which lets us determine whether *a* is a square based on residues of products *ja*, where *j* ranges over the "first half" of residues mod *p*. After this, we stated and applied the Quadratic Reciprocity Law.

# Review

Last class period we wrote down some rules for determining whether -1 or 2 is a square modulo a given odd prime *p*. Let's try to put these skills to the test.

#### Example: Determining whether -2 is a square

Let's try to determine whether -2 is a square modulo 467, 569, 821 and 383 (all these numbers are prime). For the first one, we notice that

(2)Now to determine whether -1 is a square mod 467, we note that $467 \equiv 3 \mod{4}$. This means that -1 is not a square. On the other hand, to determine whether 2 is a square mod 467, we note that $467 \equiv 3 \mod{8}$. This means that 2 is also not a square mod 467. Hence we have

(3)and so we see that -2 is a square mod 467.

Similarly we have

(4)$\square$

# Gauss' Lemma

Having practiced the rules we learned last time, let's prove the result concerning the Legendre symbol $\left(\frac{2}{p}\right)$. To do so, we'll need the following

Gauss' Lemma: For

pan odd prime and $p \nmid a$, let$\displaystyle n=\#\left\{1 \leq j \leq \frac{p-1}{2}: \begin{array}{cc}\mbox{ the least non-neg residue of }\\ja \mbox{ is greater than}\frac{p}{2}\end{array}\right\}.$

Then $\left(\frac{a}{p}\right) = (-1)^n$.

Before we prove this result, let's see it in practice.

#### Example: Is 5 a square mod 11?

Let's try to compute $\left(\fra{5}{11}\right)$. For this, we're told we need to compute $5j$ for values of *j* between 1 and $\frac{11-1}{2} = 5$. So let's do it:

Notice that there are 2 residues on this list which are greater than $\frac{11}{2} = 5.5$, and so Gauss' Lemma says that

(6)$\square$

Proof of Gauss' Lemma: To start off, we'll split the least non-negative residues from the set

(7)into two groups: the set $r_1,\cdots, r_n$ will be the set of those residues that are greater than $\frac{p}{2}$, and the set $s_1,\cdots, s_m$ of residues which are less than $\frac{p}{2}$. Notice that none of these residues actually hit $\frac{p}{2}$ on the nose, since this number is not an integer. So really we have $\{r_1,\cdots, r_n\} \subseteq \{\frac{p+1}{2},\cdots,p-1\}$ and $\{s_1,\cdots, s_m\}\subseteq \{1,\cdots,\frac{p-1}{2}\}$.

Now we claim that the integers

(8)are the same modulo *p* as the integers

To see that this is true, notice that the integers from 8 are all between 1 and $\frac{p-1}{2}$ — the $s_j$ certainly live in this range, but since we have $\frac{p+1}{2}\leq r_i \leq p-1$ we also have $1 \leq p-r_i \leq \frac{p-1}{2}$. So to show that these collections are the same, we just need to show that the top collection has no repeats.

For this, we'll check three things:

- there are no repeats of the form $p-r_i \equiv p-r_j \mod{p}$
- there are no repeats of the form $s_i \equiv s_j \mod{p}$ and
- there are no repeats of the form $p-r_i \equiv s_j \mod{p}$.

To check the first, let $k_i,k_j$ be given so that $r_i \equiv k_i \cdot a$ and $r_j \equiv k_j \cdot a$. Then we get

(10)Hence if $r_i$ and $r_j$ arose by multiplying *a* by distinct (mod *p*) numbers $k_i$ and $k_j$, then $p-r_i \not\equiv p-r_j \mod{p}$. This means we solved condition 1 above.

The proof that condition 2 works is the same as that for condition 1. For condition 3, suppose that $p-r_i \equiv s_j \mod{p}$. Then let's let $k_1$ be an integer between 1 and $\frac{p-1}{2}$ so that $r_i \equiv k_i\cdot a\mod{p}$, and let's let $k_j$ be an integer between 1 and $\frac{p-1}{2}$ so that $s_j \equiv k_j \cdot a \mod{p}$. Then we have

(11)This latter congruence, though, is impossible, since $-k_i$ has least non-negative residue between $\frac{p+1}{2}$ and $p-1$. So this means condition 3 is satisfied as well.

Now that we've established our claim that 8 and 9 are the same sets mod *p*, we'll compute $\left(\frac{p-1}{2}\right)!$. Now we know that this factorial is given by multiplying all the elements in together, which means that it's the same as multiplying all the elements in 8 together. Hence:

Now we can cancel the factorial on both sides of this equation (since this factorial is relatively prime to *p*, as it is the product of numbers all relatively prime to *p*). This leaves us with

Moving the minus ones to the other side of the equation, and recalling Euler's Criterion, tells us that

(14)$\square$

Corollary: For any odd prime

pwe have$\displaystyle \left(\frac{2}{p}\right) = \left\{\begin{array}{rl}1,&\mbox{ if }p \equiv 1,7 \mod{8}\\-1, & \mbox{ if } p \equiv 3,5 \mod{8}.\end{array}\right.$

Proof: Gauss' Lemma tells us that to compute $\left(\frac{2}{p}\right)$, we need to count the *j* between 1 and $\frac{p-1}{2}$ for which $2j$ has least non-negative residue greater than $\frac{p}{2}$. But since our *j* lie in the range between 1 and $\frac{p-1}{2}$, this means that $2j$ lies in the range between 1 and $p-1$. In other words, we don't need to worry about "modding out" by any multiple of *p* to compute the least non-negative residue for $2j$: the product $2j$ is already the least non-negative residue mod *p*. Hence we can say that the least non-negative residue of $2j$ mod *p* is greater than $\frac{p}{2}$ precisely when

Since *j* is an integer and $\frac{p}{4}$ is not, we can rewrite this last inequality as

The number of *j* between 1 and $\frac{p-1}{2}$ which satisfy this criteria is $\frac{p-1}{2}-\left\lceil \frac{p}{4}\right\rceil+1$. Hence we have

All we need to do now is determine conditions on *p* that tells us when $\frac{p-1}{2}-\left\lceil \frac{p}{4}\right\rceil+1$ is even or odd. For this, we'll do some investigating mod 8.

Case I: Suppose that $p \equiv 1 \mod{8}$. This tells us that $p = 8k+1$ for some integer *k*. In this case we get

Since this number is even, that means we have $\left(\frac{2}{p}\right) = (-1)^{2k} = 1$.

Case II: Suppose that $p \equiv 3 \mod{8}$. This tells us that $p = 8k+3$ for some integer *k*. In this case we get

Since this number is even, that means we have $\left(\frac{2}{p}\right) = (-1)^{2k+1} = -1$.

Case III: Suppose that $p \equiv 5 \mod{8}$. This tells us that $p = 8k+5$ for some integer *k*. In this case we get

Since this number is even, that means we have $\left(\frac{2}{p}\right) = (-1)^{2k+1} = -1$.

Case IV: Suppose that $p \equiv 7 \mod{8}$. This tells us that $p = 8k+7$ for some integer *k*. In this case we get

Since this number is even, that means we have $\left(\frac{2}{p}\right) = (-1)^{2k+2} = -1$.

$\square$

# Quadratic Reciprocity

Recall that for an arbitrary integer $n = \pm 2^e p_1^{e_1}\cdots p_k^{e_k}$ and an odd prime *p* not dividing *n*, we have

Now these first two terms we know how to compute, based on the residue class of *p* modulo 4 and 8 (respectively). But what about the rest? If *q* is an odd prime distinct from *p*, how do we compute the Legendre symbol $\left(\frac{q}{p}\right)$? Though this sounds like a much more daunting task than the Legendre symbols we computed for -1 and 2, it is in fact just as easily resolved.

Theorem (Quadratic Reciprocity): Suppose that

pandqare 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.$

Notice that this theorem tells us that if either *p* or *q* is congruent to 1 modulo 4, then we have

and that if both *p* and *q* are congruent to 3 modulo 4, then we have

#### Example: This might have seemed impossible yesterday…

Let's try to compute $\left(\frac{1061}{1721}\right)$. It will help to know that both of these are prime, and it turns out that we also know that $1061 \equiv 1 \mod{4}$. Quadratic reciprocity then tells us that

(25)Now since $1721 \equiv 660 \mod{1061}$, this means that we have

(26)Now you might be tempted to use quadratic reciprocity to "flip" this Legendre symbol, but note that it isn't a prime number! That means we can't flip it, but instead need to factor 660 in the hopes of factoring the Legendre symbol into simpler terms. For this, we used the fact that $660 = 2^2\cdot 3 \cdot 5\cdot 11$, so that

(27)Now the first of these terms is clearly 1, since $2^2$ is "visibly" a square. For the other terms, we'll use quadratic reciprocity to flip them. For all these Legendre symbols, notice that the "denominator" is 1 modulo 4, meaning that we can flip the symbol without introducing a minus sign. Hence we have

(28)Again, to compute these symbols we just reduct 1061 modulo 3, 5 and 11. It turns out that $1061 \equiv 2 \mod{3}$, $1061 \equiv 1 \mod{5}$, and that $1061 \equiv 5 \mod{11}$. We can substitute these values in to find

(29)Now the first term must be -1 based on our rule for whether *2* is a square modulo an odd prime (in particular, $3 \equiv 3 \mod{8}$, meaning that *2* isn't a square mod 3). The second term is "visibly" 1 since $1 = 1^2$. The last term was computed earlier in class as 1. So all together, we get

$\square$