Second Supplement to Law of Quadratic Reciprocity

Theorem
$$\left({\frac{2}{p}}\right) = (-1)^{(p^2-1)/8} = \begin{cases} +1 & : p \equiv \pm 1 \pmod {8} \\ -1 & : p \equiv \pm 3 \pmod {8} \end{cases}$$

where $$\left({\frac{2}{p}}\right)$$ is defined as the Legendre symbol.

Proof
Consider the numbers in the set $$S = \left\{{2 \times 1, 2 \times 2, 2 \times 3, \dots, 2 \times \frac {p-1}2}\right\} = \left\{{2, 4, 6, \dots, p-1}\right\}$$.

From Gauss's Lemma, we have that $$\left({\frac{2}{p}}\right) = \left({-1}\right)^n$$ where $$n$$ is the number of elements in $$S$$ whose least positive residue modulo $$p$$ greater than $$\frac p 2$$.

As they are, the elements of $$S$$ are already least positive residues of $$p$$ (as they are all less than $$p$$).

What we need to do is count how many are greater than $$\frac p 2$$.

So, we see that $$2 k > \frac p 2 \iff k > \frac p 4$$.

So the first $$\left \lfloor {\frac p 4} \right \rfloor$$ elements of $$S$$ are not greater than $$\frac p 2$$, where $$\left \lfloor {\frac p 4} \right \rfloor$$ is the floor function of $$\frac p 4$$.

The rest of the elements of $$S$$ are greater than $$\frac p 2$$.

So we have $$n = \frac {p-1}2 - \left \lfloor {\frac p 4} \right \rfloor$$.

Consider the four possible residue classes modulo $8$ of the odd prime $$p$$.


 * $$p = 8 k + 1$$:

$$ $$ $$ $$


 * $$p = 8 k + 3$$:

$$ $$ $$ $$


 * $$p = 8 k + 5$$:

$$ $$ $$ $$


 * $$p = 8 k + 7$$:

$$ $$ $$ $$

We see that $$n$$ is even when $$p = 8 k + 1$$ or $$p = 8 k + 7$$ and odd in the other two cases.

So from Gauss's Lemma, we have:
 * $$\left({\frac{2}{p}}\right) = (-1)^n = 1$$ when $$p = 8 k + 1$$ or $$p = 8 k + 7$$;
 * $$\left({\frac{2}{p}}\right) = (-1)^n = -1$$ when $$p = 8 k + 3$$ or $$p = 8 k + 5$$.

As $$7 \equiv -1$$ and $$5 \equiv -3 \pmod 8$$ the result follows.