# General integer solution for x^2+y^2-z^2=+/-1

How to find general solution (in terms of parameters) for diofantine 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.

Victor Kuliamin

-
add comment

## 3 Answers

I think that the solutions to $x^2+y^2-z^2=-1$ are $x=RT-SU,y=RU+ST$ where $R^2+S^2-T^2-U^2=2$ then $z=R^2+S^2-1=T^2+U^2+1$ On the surface this looks similar to the solutions to the $+1$ case. However these are quite a bit rarer and depend on the locations of the primes.

As we know, an integer can be uniquely written as $n=ab^2$ where $a$ (the squarefree part of $n$) is a product of distinct primes. $n$ can be written as a sum of two squares $n=j^2+k^2$ precisely when $a$ has no prime divisors of the form $4m+3$ (and we know in how many ways this can be done as well.) So the solutions depend on when we have 2 consecutive even numbers of this form.

For example $292=73\cdot4^2$ and $290=2\cdot5\cdot329$ thus we know that there are expressions as a sum of two squares: $$292=6^2+16^2$$ $$290=1^2+17^2=11^2+13^2.$$ Running through the various possiblities gives these solutions for $R,S,T,U,x,y$ with $x^2+y^2-291^2=-1:$

• 6, 16, 17, 1, 86, 278
• 16, 6, 11, 13, 98, 274
• 16, 6, 17, 1, 266, 118
• 16, 6, 13, 11, 142, 254

Certain families of solutions can be given. One is $x,y,z=2p,2p^2,2p^2+1.$

-
Thank you. I like this answer too. –  Victor Kuliamin Jun 15 '11 at 9:51
add comment

I believe the general solution to $x^2+y^2-z^2=1$ is $x=(rs+tu)/2$, $y=(rt-su)/2$, $z=(rs-tu)/2$, where $rt+su=2$.

EDIT: Solutions to $x^2+y^2+1=z^2$ can be obtained by choosing $a$, $b$, $c$, $d$ such that $ad-bc=1$ and then letting $x=(a^2+b^2-c^2-d^2)/2$, $y=ac+bd$, $z=(a^2+b^2+c^2+d^2)/2$, though I'm not sure you get all the integer solutions this way.

The rational solutions are a bit easier. $(0,0,1)$ is a (rational) point on the surface. The line $(0,0,1)+t(a,b,c)$ through that point intersects the surface again at $x=2ac/(a^2+b^2-c^2)$, $y=2bc/(a^2+b^2-c^2)$, $z=(a^2+b^2+c^2)/(a^2+b^2-c^2)$, giving all the rational points on the surface.

-
Looks good. One way of getting there is setting $a:=x+z, b:=x-y$ to obtain $ab=(1+y)(1-y)$, so that there must be $r,s,t,u$ with $rs=a,tu=b,1+y=rt,1-y=su$. –  Klaus Draeger May 25 '11 at 13:35
Nice! but You mean $b=x-z$ –  Aaron Meyerowitz May 25 '11 at 17:02
oops - yes, of course. Thanks! –  Klaus Draeger May 25 '11 at 18:20
Thank you very much. –  Victor Kuliamin Jun 15 '11 at 9:49
add comment

The question is the same as looking for points of norm 1 or -1 in the unimodular Lorentzian lattice $Z^{1,2}$. This has an infinite group of automorphisms, with an index 2 subgroup that is a Coxeter group generated by 3 reflections. This group acts transitively on the vectors of norm 1 and -1 if I remember correctly, so all solutions can be obtained from 1 particular solution by acting with this group.

-
add comment