Let $p > 3$ be a prime number. Show that $x^2 \equiv −3\mod p$ is solvable iff $p\equiv 1\mod 6$. Let $p > 3$ be a prime number. Show that $x^2 \equiv −3\mod p$ is solvable iff $p\equiv 1\mod 6$.
My try is
let $a$ be a solution of $x^2 \equiv -3 \mod p$. so $a^{p-1} \equiv 1\mod p$. This implies 
$$(-1)^{\frac{p-1}2}≡(a^2)^\frac{p-1}2 \mod p.$$
since $p$ is odd, $\frac{p-1}2$ must be even, so $4|(p-1)$. conversely, assume that $p\equiv 1\mod 6...$

$x^2\equiv-3\pmod p$ is solvable iff $(-3|p)=(-1|p)(3|p)=1$. ($(\,\cdot\,|\,\cdot\,)$ is the Legendre symbol.)
We already have:
$$\begin{align}
(-1|p)&=\begin{cases} 1 &\text{if}\ p\equiv1\pmod4 \\ -1 &\text{if}\ p\equiv-1\pmod4 \end{cases},\\
(3|p)&=\begin{cases} 1 &\text{if}\ p\equiv\pm1\pmod{12} \\ -1 &\text{if}\ p\equiv\pm5\pmod{12} \end{cases}.
\end{align}$$
(you can easily prove these by quadratic reciprocity, with seperating cases.)
So we have:
$$(-3|p)=\begin{cases} 1 &\text{if}\ p\equiv1\pmod6 \\ -1 &\text{if}\ p\equiv-1\pmod6 \end{cases},$$
and that is the result.
