Let $p> 7$, prove that $\left(\frac{2}{q}\right) = (-1)^{\frac{q^2-1}{8}}$ with $q$ an odd prime Let $p> 7$, prove that $\left(\frac{2}{q}\right) = (-1)^{\frac{q^2-1}{8}}$. with $q$ an odd prime. We can by using the following verifications:

$$\left(\frac{2}{p}\right) = \left(\frac{8-p}{p}\right) = \left(\frac{p}{p-8}\right) = \left(\frac{2}{p-8}\right)$$

I don't see how to use these verifications for the proof to be honest and how to prove these verifications. 
Suppose $p \equiv 1,3 \pmod 4$. 
If $p \equiv 1 \pmod {4}$ we get that:
$p-8 \equiv 1 \pmod {8}$ or $p-8 \equiv 5 \pmod {8}$. 
if $p \equiv 3 \pmod {4}$, we get that:
$p-8 \equiv 3 \pmod {8}$ or $p-8 \equiv -1 \pmod {8}$. 
So we see that the second equation works only if $p-8 \equiv p \equiv 1 \pmod{4}$. But what about the other case. I am quite confused here, can i get a hint in the right direction please?
Kees

Hint : For a prime $p>2$, we have $$(\frac{2}{p})=1$$, if and only if $$p\equiv \pm1\ (\ mod\ 8)$$
