First assume that $p>2$ (because when $p=2$ the equation $u^2+v^2=8$ is easily solved).
Now use the following trick to form $2p-u-v$ :
and use the difference of squares :
Let $q$ be a prime factor of both $2p-u-v$ and $2p+u+v$ so :
$$q \mid (2p-u-v)+(2p+u+v)=4p$$
$$q \mid (2p+u+v)-(2p-u-v)=2(u+v)$$
Now let's consider two cases :
- If $q$ is odd then $q \mid p$ but because $p$ is prime it follows that $q=p$ and then $p \mid u+v$ .
But then :
$$p \mid (u+v)^2-(u^2+v^2)=2uv$$
$$p \mid uv$$
If for example $p \mid u$ then also $p \mid v$ because $p \mid u+v$ .Thus both $u$ and $v$ are divisible with $p$ and so :
$$2p^2=u^2+v^2 \geq p^2+p^2=2p^2$$
Thus we must have $u=v=p$ and $2p-u-v=0$ is a perfect square .
- If none of the common prime factors $q$ is odd then their gcd must be a power of two , some $2^k$
Using the identity :
it follows that $2p-u-v=2^kx^2$ and $2p+u+v=2^ky^2$ for some $x$ and $y$ .
Thus if $k$ is even then $2p-u-v$ is a perfect square and if it's odd it's twice a perfect square which proves the claim .