I need to describe all odd primes $p$ for which $7$ is a quadratic residue.
Now let $\left(\frac{a}{b}\right)$ be the Legendre Symbol.
Then if $7$ is a quadratic residue $p$ we must have:
$$1=\left(\frac{7}{p}\right)=(-1)^{\frac{3(p-1)}{2}} \left(\frac{p}{7}\right)$$
Here I have used Gauss theorem on Quadratic Reciprocity.
This implies that $\left(\frac{p}{7}\right)=1$ and $(-1)^{\frac{3(p-1)}{2}} = 1$, or $\left(\frac{p}{7}\right)=-1$ and $(-1)^{\frac{3(p-1)}{2}} = -1$.
HOWEVER at this step in the solutions, we are given that:
$\left(\frac{p}{7}\right)=1$ and $p\equiv 1\bmod 4$
OR $\left(\frac{p}{7}\right)=-1$ and $p\equiv -1\bmod 4$
Why is this equivalent? So what I am basically asking is the following:
Why is $(-1)^{\frac{3(p-1)}{2}} = 1$ equivalent to $p\equiv 1\bmod 4$?
And $(-1)^{\frac{3(p-1)}{2}} = -1$ equivalent to $p\equiv -1\bmod 4$?
Best Answer
$$(-1)^n\equiv\begin{cases} \hphantom{-}1 & \text{if }n\equiv 0\bmod 2\\ -1 & \text{if }n\equiv 1\bmod 2 \end{cases}$$ Since $p$ is odd, we know that $p-1$ is even, so $\frac{p-1}{2}$ is an integer.
By definition, $\frac{p-1}{2}\equiv 0\bmod 2$ if and only if $\frac{p-1}{2}=2x$ for some integer $x$, which is equivalent to saying $p=4x+1$ for some integer $x$, which by definition is equivalent to $p\equiv 1\bmod 4$.
Similarly, $\frac{p-1}{2}\equiv 1\bmod 2\iff p\equiv 3\bmod 4$.
Now observe that $$(-1)^{\tfrac{3(p-1)}{2}}=\left((-1)^3\right)^{\tfrac{p-1}{2}}=(-1)^{\tfrac{p-1}{2}}=\begin{cases} \hphantom{-}1 & \text{if }\frac{p-1}{2}\equiv 0\bmod 2\\ -1 & \text{if }\frac{p-1}{2}\equiv 1\bmod 2 \end{cases}=\begin{cases} \hphantom{-}1 & \text{if }p\equiv 1\bmod 4\\ -1 & \text{if }p\equiv 3\bmod 4 \end{cases}$$