Homework Help: Another number theory proof

1. Mar 3, 2007

ElDavidas

1. The problem statement, all variables and given/known data

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)$

3. 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.