# Showing that $x^2+y^2+z^2=k^2$ has infinitely many integer solutions

I've written down the following proof:

Given positive integers $$x,y,z,k$$ we have: $$[1]\;\;\;\;x^2+y^2+z^2=k^2, \rightarrow x^2+y^2=(k-z)(k+z)$$ We now let $$k=z+1$$, thus: $$x^2+y^2=2z+1$$ Let $$z$$ be even i.e. $$z=2z'$$, then:$$[2]\;\;\;\;x^2+y^2=4z'+1$$ We know that there exist an infinite amount of primes of the form $$4m+1$$, therefore there are infinitely many $$z'$$s such that $$4z'+1$$ is prime.

By Fermat's theorem in additive number theory we know that if $$p \equiv 1 \pmod4$$ then $$p=u^2+v^2$$ for some positive integer $$u$$ and $$v$$, since for every prime of the form $$4z'+1 \equiv 1 \pmod4$$, there are infinitely many solutions to $$[2]$$ therefore there are infinitely many solutions to $$[1]$$.

I know this proof is probably an "overkill" for the question and that I should prove the two statements I used (infinitely many primes and F.Theorem), but I think the proof is nonetheless correct right? Also, how can I prove that there are infinitely many solutions to $$[1]$$ such that $$(x,y,z)=1$$ ?

• I guess a proof would be that: $x=1, y=2k$ and $z=2k^2$ does the work since: $$1+(2k)^2+(2k^2)^2=1+4k^2+4k^4=(1+2k^2)^2$$ which satisfies our conditions, but this is a sort of "parametrization" – Spasoje Durovic Feb 9 '19 at 15:06
• – Robert Z Feb 9 '19 at 15:09

After thinking about it for a while I noticed that, if:$$4z'+1=x^2+y^2$$ Then $$x$$ and $$y$$ must have opposite parity, not only that, it must be the case that $$(x,y)=1$$, suppose to the contrary, $$(x,y)=k$$ for some $$k\ge2$$, then:$$x^2+y^2=(kx')^2+(ky')^2=k^2(y'^2+x'^2)$$ thus $$k^2\;|\;x^2+y^2=4z'+1$$ and that implies that $$4z'+1$$ is not prime, which is a contraddiction thus $$(x,y)=1$$ and therefore $$(x,y,z)=1$$