$p\equiv 1,2,3\text{ mod }8 \Rightarrow p=a^2+2b^2\text{ for some $a,b\in\mathbb{Z}$.}$ Let $p$ be a prime number. I could already show, that $\mathbb{Z}[\sqrt{-2}]$ is an euclidean domain and that $$p\text{ reducible }\Leftrightarrow\text{ }p=a^2+2b^2\text{ for some $a,b\in\mathbb{Z}$.}$$
Now I wonder how to prove
$$p\equiv 1,2,3\text{ mod }8 \Rightarrow p=a^2+2b^2\text{ for some $a,b\in\mathbb{Z}$.}$$
Maybe there is a possibility to show
$$p\equiv 1,2,3\text{ mod }8 \Rightarrow p\text{ reducible }?$$
 A: $p$ splits iff $$\left(\frac{-2}{p}\right)=1$$
That is either $$\left(\frac{-1}{p}\right)=1, \left(\frac{2}{p}\right)=1$$
in which case $p\equiv 1(\mod 8)$, or
$$\left(\frac{-1}{p}\right)=-1, \left(\frac{2}{p}\right)=-1$$
in which case $p\equiv 3(\mod 8)$
A: 1.
I'll start by dealing with odd primes p.
$(p)$ is a prime in $\mathcal{O}=\mathbb{Z}[\sqrt{-2}]$  (doesn't split) if and only if $\mathcal{O}/(p)$ is a field. If $\mathcal{O}/(p)$ has any zero divisors, then it implies $(p)=\mathfrak{a}\cdot\bar{\mathfrak{a}}$; it is a product of prime ideals. Here, $(p)$ is a principal ideal generated by a rational prime $p$, and $\mathfrak{a}$, $\bar{\mathfrak{a}}$ are a conjugate pair of non-rational prime ideals.
Since you know $\mathcal{O}$ is euclidean, this tells you it is a UFD, which implies $\mathfrak{a}=(\alpha)$ for some $\alpha=a+b\sqrt{-2}$.
Now, if $R=\mathcal{O}/(p)$ is a field, then $R$ is isomorphic to a finite field of order $p^2$. You can see this by counting the elements of said quotient ring. To determine for a specific prime $p$, there's an easy test to see if its a finite field. 
Take an arbitrary element $\gamma \in R$ and raise it to the power $p$. If you can find one such that $\gamma^{p}\neq\gamma$ in $R$, then $R$ is indeed a field of order $p^2$. If you can't find such a $\gamma$, it is not a field of order $p^2$ or even one of order $p$ since $R$ is a ring with $p^2$ elements. This is what it looks like to look for such a $\gamma$.
For starters, let $\gamma=c+d\sqrt{-2}$. Applying this power map in $R$ gives the following:
$\gamma^{p}=\Big(\displaystyle\sum_{i=0}^{p} \binom{p}{i}c^{p-i}(\sqrt{-2})^{i}d^{i}\Big)\equiv c^{p}+(-2)^{\frac{p}{2}}d^{p} \pmod{p}$
Since $c$ and $d$ are rational integers, Fermats little theorem tells us
$\gamma^{p}\equiv c+(-2)^{\frac{p}{2}}d \pmod{p}$
Rewriting $(-2)^{\frac{p}{2}}$ as $(-2)^{\frac{p-1}{2}}\cdot\sqrt{-2}$, it becomes obvious that $\gamma^{p} \equiv \gamma$ for all $\gamma$ in $R$ if and only if 
$(-2)^{\frac{p-1}{2}} \equiv 1 \pmod{p}$.
This tells you which rational primes can be written as $a^2+2b^2$ for integers $a$ and $b$
I'm going to wrap this up as best as I can from here to explain why modulo 8 pops up.
For some reason, working in the cyclotomic field $K=\mathbb{Q}(e^{\frac{\pi\imath}{4}})$ to solve this problem becomes a walk in the park. It is the case that $\mathcal{O} \subset \mathcal{O}_{K}$... which is pretty nice since it tells us $\sqrt{-2}$ just so happens to "live" in $K$ as well.
All you have to do is look at $(p)$ in $\mathcal{O}_{K}$, something something something, and then a miracle happens:
$\displaystyle (-2)^{\frac{p-1}{2}}\equiv\frac{e^{\frac{\pi\imath}{4}p}-e^{\frac{-\pi\imath}{4}p}}{e^{\frac{\pi\imath}{4}}-e^{\frac{-\pi\imath}{4}}}\equiv\frac{\sin(\frac{\pi}{4}p)}{\sin(\frac{\pi}{4})} \pmod{p}$
For me, this approach of extending a quadratic field $E$ to a cyclotomic extension $F$ was what elucidated the dependence of a rational prime ideal $(p)$'s primality on residue classes modulo $E$'s discriminant
2.
2=0^2+2*1^2
