Second Supplement to Law of Quadratic Reciprocity

Theorem

 * $\displaystyle \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({\dfrac 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 \dfrac {p-1}2}\right\} = \left\{{2, 4, 6, \dots, p-1}\right\}$.

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

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

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

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

So we have $n = \dfrac {p-1}2 - \left \lfloor {\dfrac 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({\dfrac 2 p}\right) = (-1)^n = 1$ when $p = 8 k + 1$ or $p = 8 k + 7$
 * $\left({\dfrac 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.