# Another number theory proof

## Homework Statement

Let $p$ be an odd prime. Show that $x^2 \equiv 2 (mod p)$ has a solution if and only if $p \equiv 1 (mod 8)$ or
$p \equiv -1 (mod 8)$

## The Attempt at a Solution

Ok, I figured the more of these I try, the better I'll get at them. Assuming that
$x^2 \equiv 2 (mod p)$ has a solution first. I get

$$1 = ( \frac{2}{p} )= -1^{\frac{p^2 - 1}{8}}$$

So $$1 = -1^{\frac{p^2 - 1}{8}}$$.

This implies that $\frac{p^2 - 1}{8}$ must be even. So

$\frac{p^2 - 1}{8} = 2k$ for an integer $k$.

I'm not sure if I'm on the right track though. Any hints would be appreciated.