Are there integral solutions to the equation $x^2+y^2-z^2=1$?


The advanced approach is to rewrite this as $x^2+y^2= z^2+1$ and use unique factorization in $\mathbb Z[i]$. Assuming you disallow the obvious answers where $x$ or $y$ is $\pm 1$, you get that $x+yi=(a+bi)(c+di)$ and $z+i=(a+bi)(c-di)$ for some $a,b,c,d$. That yields a condition on $a,b,c,d$ and an explicit formulas form $x,y,z$ in terms of $a,b,c,d.$

Specifically, if $bc-da=1$ then $x=ac-bd, y=bc+ad, z=ac+bd$ is a solution to your equation. I think this gives all of them, but there is some concern about units.

This doesn't give us all ordered triples, since $y=bc+ad=bc-ad+2ad=1+2ad$, and hence this only gives us $y$ odd. However, it is clearly true that one of $x,y$ has to be odd, so this might sill give all un-ordered pairs $x,y$.

For example, $(a,b,c,d)=(7,2,4,1)$ then $x=26, y=15, z=30$ is the solution.

A more elementary solution is to assume $y=2n+1$ is odd (one of $x,y$ must be odd.) Then $x$ and $z$ have to have the same parity, and we get: $$4n(n+1)=y^2-1 = z^2-x^2=(z-x)(z+x)$$

Dividing by $4$: $$n(n+1)=\frac{z-x}{2}\frac{z+x}{2}$$

So we just need a factorization, $n(n+1)=UV$ with $U<V$. Then $z=V+U$ and $x=V-U$.

The most basic answer is $V=n(n+1)$ and $U=1$. Then $x=n(n+1)-1, y=2n+1, z=n(n+1)+1$.

The "obvious" answer, $U=n$, $V=n+1$ just gets you $x=1, y=2n+1, z=2n+1$.

Since $n(n+1)$ is even, we can write $U=2$, $V=\frac{n(n+1)}{2}=T_n$. Then $$x=T_n-2, y=2n+1, z=T_n+2$$

When $n>0$ we see that the number of distinct positive solutions $(x,2n+1,z)$ is $$\frac{\tau(n(n+1))}{2}=\frac{\tau(n)\tau(n+1)}2$$

If $UV=n(n+1)$ we can get $a,b,c,d$ from the first solution by defining: $$a=(V,n), b=(U,n+1), c=(V,n+1), d=(U,n)$$

then $$bc=n+1, ad=n, ac=V, bd=U$$

So $bc-ad=1$, $bc+ad=2n+1=y$, $V-U=ac-bd=x$ and $V+U=ac+bd=z$.

So any result from the second method is a result from the first method, which means the first method gets all positive solutions, too.

  • $\begingroup$ Ha ha +1. Had the almost same realization :) $\endgroup$ – user17762 Apr 4 '13 at 21:26

Recall the Brahmagupta formula $$(ad-bc)^2 + (ac+bd)^2 = (a^2+b^2)(c^2+d^2) = (ac-bd)^2 + (ad+bc)^2$$ Now find $a,b,c,d$ such that say $ad-bc = 1$. Then set $z = ac+bd$, $x=ac-bd$ and $y = ad+bc$ to get a solution.

For instance, one such one parameter family solution following the above procedure is $$x = 2t, y = 2t^2-1, z = 2t^2$$ where $a = d = t, b = (t+1), c = (t-1)$ since $t^2 - (t^2-1) = 1$.


the equation:


Solutions can be written using the solutions of Pell's equation: $p^2-2k(k-1)s^2=1$

$k$ - given by us.

Solutions hav e form:




And more:




  • $\begingroup$ That’s the wrong equation. The correct equation is $x^2+y^2=z^2+1.$ $\endgroup$ – Thomas Andrews Jan 10 at 7:09
  • $\begingroup$ @ThomasAndrews I also gave another equation. So that you can compare the solutions. $\endgroup$ – individ Jan 10 at 10:36

Yes: $(1,1,1)$. Are you after all of them?

  • $\begingroup$ (7,4,8) is another solution I found. Is there a parametric equation that can generate all solutions? $\endgroup$ – fermats Apr 4 '13 at 21:02

We can take the equation to $x^2 + y^2 = 1 + z^2$ so if we pick a $z$ then we just need to find all possible ways of expressing $z^2 + 1$ as a sum of two squares (as noted in the comments we always have one way: $z^2 + 1$). This is a relatively well known problem and there will be multiple possible solutions for $x$ and $y$, there is another question on this site about efficiently finding the solutions of this should you wish to do so.

  • $\begingroup$ Um, $z^2+1$ is expressed as the sum of two squares. What you want is whether there is more than one way to express $z^2+1$ as the sum of two squares, which is essentially whether $z^2+1$ has more than one odd prime factor. $\endgroup$ – Thomas Andrews May 25 '14 at 2:35
  • $\begingroup$ @ThomasAndrews yes, that was unclear. Thanks! $\endgroup$ – Alex J Best May 25 '14 at 10:12

Of course for the equation $X^2+Y^2=Z^2+t$

There is a particular solution:




But interessuet is another solution:


If you use the solution of Pell's equation: $p^2-2s^2=\pm1$

Making formula has the form:




number $L$ and any given us.

The most interesting thing here is that the numbers $a,b,c$ it Pythagorean triple. $a^2+b^2=c^2$

This formula is remarkable in that it allows using the equation $p^2-2s^2=\pm{k}$

Allows you to find Pythagorean triples with a given difference.





Pretty is not expected relationship between the solutions of Pell's equation and Pythagorean triples.


You can use the isomorphism T between SO(2,1) and SL(2) which is heavily used in physics. What it boils down to is that for every unimodular 2x2 matrix there is a 3x3 matrix of hyperbolic motions that has 3 unit (in Lorentzian sense) vectors for its columns.

So in those columns you not only get 2 solutions to your problem but also a solution to


Here it is in Mathematica code:

T[{{a_, b_}, {c_, d_}}] := {
{(a^2 + b^2 - c^2 - d^2)/2, (a^2 - b^2 - c^2 + d^2)/2, -ab + cd},
{-ac - bd, bd - ac,ad + bc},
{(a^2 + b^2 + c^2 + d^2)/2, (a^2 - b^2 + c^2 - d^2)/2, -ab - cd}

So when you take for instance modular matrix m={{1,4},{2,9}}, you get the following columns:

u={-34,-38,51} v={31,34,-46} w={14,17,-22}

The first solves the "-1" equation, the second and third solve yours.



If $s$ and $t$ are any integers, then $x=2st+t+1$, $y=2s(st+t+1)+1$, $z=2s(st+t+1)+t+1$ satisfy $x^2+y^2-z^2=-1$. This is a simple way to get a 2-parameter family of solutions (without having to solve auxilary equations such as Pell's equation). I stumbled across this solution by considering a problem in finite geometry.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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