Suppose $2$ is a quadratic residue modulo $p$ for an odd prime $p$. That is, there is an element $u$ such that $u^2 \equiv 2 \pmod{p}$.
From here, can we prove that there exist integers $a$ and $b$ such that $$a^2-2b^2=p$$ Its the equality part that is tricky. It is trivial to produce $a,b$ where $a^2-2b^2 \equiv 0 \pmod{p}$, for example when $a=u, b=1$. Is there some way of starting with $(u,1)$ and constructing $(a,b)$ from it? If not constructing algorithmically, is there at least an existential argument?
This is related to the problem of finding for which primes $p$ is $2$ a quadratic residue. If we can prove the above, then from the form of $p=a^2-2b^2$, it is easy to see that $p=8k \pm 1$. I know a proof which uses quadratic fields. It shows that $p$ cannot be prime in $\mathbb{Z}[\sqrt{2}]$ and thus it is of the form $p=(a+\sqrt{2}b)(a-\sqrt{2}b)$. However, it seems (to me) like an overkill to use non-trivial results from quadratic fields for this. Surely there's got to be an elegant method which stays within $\mathbb{Z}/p\mathbb{Z}$



I don't know much about field theory but within the laws of elementary mathematics, note that by Thue's Lemma we have $$x \equiv uy \pmod p$$ For $u^2 \equiv 2 \pmod p$, such that $0<|x|,|y|<\sqrt{p}$. Then proceed to notice $$x^2-2y^2 \equiv 0 \pmod p$$ Then notice $$-2p<x^2-2y^2<p$$ So $x^2-2y^2=0$ or $x^2-2y^2=-p$. I believe you can proceed from here.
If you actually want to see the full solution, pass your mouse over the yellow area.