<s>[INST] General integer solution for $x^2+y^2-z^2=\pm 1$ How to find general solution (in terms of parameters) for diophantine equations
$x^2+y^2-z^2=1$ and $x^2+y^2-z^2=-1$?
It's easy to find such solutions for $x^2+y^2-z^2=0$ or $x^2+y^2-z^2-w^2=0$ or $x^2+y^2+z^2-w^2=0$, but for these ones I cannot find anything relevant.
 [/INST] Let´s take any $x>3$ and choose a,b such that $a<b$,$a-b$ even and $ab=x^2-1$.
Then with $y=(b-a)/2$, $z=(b+a)/2$ we have $x^2 + y^2 = z^2 + 1$.
Particular cases∶
if $x$ even then $x^2 + ((x^2-2)/2)^2 = (x^2/2)^2 + 1$; 
if $x$ odd then $x^2 + ((x^2-5)/4)^2 = ((x^2+3)/4)^2 + 1$.
</s>