Hi everybody. I'd like to know if the diophantine equation

(1) $$X^2 - Y^2 - Z^2 = \pm 1$$

has been studied and if the set of its solutions $(X,Y,Z)$ is known. I appreciate any reference. Thank you very much.

P.S. If instead we look at the diophantine equation

$$X^2 - Y^2 - Z^4 = \pm 1$$

surely we can solve it imposing conditions on the solution of (1) so that Z be a square. However, is there a quicker method?

  • 1
    $\begingroup$ This is an old question, but in case someone else comes across it, we have the identity $$(289p^4+14p^2q^2-239q^4)^2-(17p^2-12pq-13q^2)^4 -(17p^2+12pq-13q^2)^4 = -1$$ where $p,q$ solve the Pell equation, $$q^2-17p^2=-1$$ So we can actually make both the $Y,Z$ of your first eqn as squares. $\endgroup$ Commented Jan 3, 2015 at 6:37

2 Answers 2


In general, if $Q(x,y,z)$ is a nonsingular ternary quadratic form with integral coefficients, then the integral solutions of $Q(x,y,z)=n$ fall into finitely many orbits of the integral automorphism group of $Q$, and these orbits can be effectively determined. For your case there is a shortcut as follows.

Write $a=x+y$, $c=x-y$, $b=z$, then your equation becomes $b^2-ac=\mp 1$. In the language of binary quadratic forms, this means that the form $au^2+2buv+cv^2$ has discriminant $\mp 4$. From classical theory it follows that after an invertible linear change of variables $u'=pu+qv$, $v'=ru+sv$ the form becomes $u'^2\pm v'^2$, i.e. there are $p,q,r,s\in\mathbb{Z}$ such that $ps-qr=1$ and $$ au^2+2buv+cv^2=(pu+qv)^2\pm(ru+sv)^2. $$ Equating coefficients, $$ a=p^2\pm r^2,\quad c=q^2\pm s^2,\quad b=pq\pm rs, $$ i.e. $$ x=(p^2\pm r^2+q^2\pm s^2)/2,\quad y=(p^2\pm r^2-q^2\mp s^2)/2,\quad z=pq\pm rs. $$ To summarize, all integer solutions of $x^2-y^2-z^2=\pm 1$ are of this form, with integers $p,q,r,s$ satisfying $ps-qr=1$. Using congruences one can easily distinguish integer solutions from half-integer ones.

As references, I suggest Rose: A course in number theory, and Cassels: Rational quadratic forms.

  • $\begingroup$ @GH Thank you! Your answer is very helpful. I have added a P.S. to my answer. $\endgroup$ Commented Nov 28, 2012 at 9:02

It is also true that the automorphism group of the quadratic form is known. See Is there a topograph for Pythagorean triples? and the three matrices. If you have any particular $x^2 + y^2 - z^2 = n,$ write $(x,y,z)$ as a column vector. Multiply by any of the three square matrices or its inverse and you get another solution for $n.$ Multiply again you get another, and so on for any combination of group elements.

I see, for your ordering you need to switch first and last elements to use these three matrices.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.