Near-Pythagorean triplets: What are the general solutions to $a^2+b^2=c^2-1$?
Obtaining the most general solution to a quadratic Diophantine equation in three variables is often easier if the equation is homogeneous. For example, by focusing on "primitive" solutions, it is easy to show that all Pythagorean triplets can be written as $$a=m(r^2-s^2), b=2mrs, c=m(r^2+s^2)$$ and that if you restrict to $(r,s)=1, r\neq s \mod 2$ no triplet is repeated.
Inhomogeneous equations can be tougher. In two variables, Pell's equation $x^2-ny^2$ is well studied, but I wanted to look at three variables. An example is $$ a^2+b^2=c^2+1 $$ which is solved by taking an arbitrary integer $r>1$ and an arbitrary integer factor $u | r(r-1)$, with $$u>\sqrt{2r^2-2r-1}-r+\frac12$$ and $u^2<r(r-1)$. (These restrictions ensure uniqueness and non-negativity). The solution is then $$ a= \frac{r(r-1)}{u}-u \\ b=2r-1 \\ c=\frac{r(r-1)}{u}+u $$ Note that the solutions are generated requiring no more difficult operations than factoring $r(r-1)$.
The next obvious case to try was $$a^2+b^2=c^2-1$$ We can see that $a$ and $b$ must both be even, and transform this using $a=2x,b=2y,c=2z-1$, to $$x^2+y^2=z^2-z$$ Here, $x$ and $y$ must be of the same parity.
I have pursued the odd-parity case by transforming to $x=2r-1,y=2s-1,z=8u+2$, which comes down to finding solutions to $$ r(r-1)+s(s-1)=2u(8u+3) $$ and with this, for small-ish values of $u$, you can generate
$$ (18,6,19), (30,18,35), (50,10,51), (38,34,51) $$
and so forth. But this does not resolve the question since $$r(r-1)+s(s-1)=2u(8u+3)$$ is just another inhomogeneous quadratic Diophantine equation, and I have not been able to find a generic solution to that either.
So my question is:
What is the general solution to $$\mathbf{a^2+b^2=c^2-1}$$
Preamble
This certainly answers the question, even if it's a little, let's say abstract in doing so.
We need to define a couple of nice concepts so that we can go through this answer. For that, I'm going to first make a historical note.
I'll be using and mainly following the note by Keith Conrad titled Pythagorean Descent.
Note : by "non-negativization" I refer to making every entry of a vector non-negative by taking the absolute value of each entry. For example, $(-3,4,-8)$ non-negativized gives $(3,4,8)$.
Introduction
It is well known that there is a nice parametrization of Pythagorean triples : a general formula that allows one to create any example by just substituting numbers for variables. This is the parametrization given by : $$ (k(x^2-y^2),2kxy,k(x^2+y^2)) $$
for integers $k,x,y$. (Note that $k=1$ gives you all primitive Pythagorean triples).
It turns out a different kind of characterisation was looked at by Berggren in 1934. What Berggren did, was prove an ascent formula for Pythagorean triples : he found three matrices $M_1,M_2,M_3$ such that , treating a vector $(x,y,z)$ as a column vector $[x,y,z]^T$ (for the purpose of matrix-vector multiplication) every primitive Pythagorean triple can be reached by multiplying the smallest primitive triple $[3,4,5]^T$ with $M_1,M_2,M_3$ in some order. For example, $M_2M_3[3,4,5]^T = (77,36,85)$ and so on.
The point is, that when Berggren found this, he actually didn't realize something that Conrad chose to point out. Indeed, what Berggren had actually done was find matrices that preserve the quantity $x^2+y^2-z^2$. For example, his $M_1$ is : $$ M_1 = \begin{pmatrix} 1 & -2 & 2 \\ 2 & -1 & 2 \\ 2 & -2 & 3 \end{pmatrix} $$
Exercise : verify that if $[a,b,c]^T = M_1[x,y,z]^T$ then $x^2+y^2-z^2 = a^2+b^2-c^2$.
So what's happening is this : I could start from some $[x,y,z]^T$ such that $x^2+y^2-z^2 = 1$, and then I just keep multiplying by $M_1$ and I have $M_1^n[x,y,z]^T$ whose components will still be a solution!
So the question that we ask ourselves is this : ok, so I know I can get plenty of solutions by somehow finding matrices that are preserving my quantity. But :
-
How did I find these matrices?
-
How can I prove that every solution can be reached using some bunch of matrices I've got?
Both these questions are answered spectacularly, using arguments that I'd say are elementary in nature and very nice to look at.
The setting
So we first visualize every integer triple in space. This is the set $\mathbb Z^3 = \{(x,y,z) : x,y,z \in \mathbb Z\}$. This is what we'd call a lattice in general.
Now, on this lattice, we can consider bilinear forms. These bilinear forms help us measure interactions of lattice elements with others, and we can design our bilinear form according to what we want to study.
For example, in this case, I want to study $x^2+y^2-z^2$. We call $N((x,y,z)) =x^2+y^2-z^2$ the "norm" of $(x,y,z)$. This is a sort of "measure" of this number. Now, for interactions, we consider the function given by $$\langle(a,b,c) , (x,y,z) \rangle = ax+by-cz$$ This sort of measures how much we think the two points interact on this lattice. Note that $\langle \cdot , \cdot \rangle$ is what we call a bilinear form(refer to the notion for vector spaces as well) : it's linear and scales in each variable. Furthermore, $\langle(a,b,c) , (a,b,c) \rangle = N(a,b,c)$.
Side note : the bilinear form is an inner product if it's positive definite, but this is clearly not the case here, so we can't use properties of inner products to guide us through.
Now, what we want to do is think about norm-preserving functions, and how we can use them to build up to larger solutions. The reason why the first kind of norm-preserving function that comes to mind is a linear transformation, is because $N(x,y,z) = x^2+y^2-z^2$ is invariant under the following linear transformations : $$ (x,y,z) \to (-x,y,z) , (x,y,z) \to (x,-y,z), (x,y,z) \to (x,y,-z) $$
because the $-$ will not matter once you take the square of each term. (You can think of more linear transformations of course, I'm just putting these ones out). So you want to search for linear transformations first.
However, there's something else about the three transformations above : if you apply them twice, they actually come back to the same point, since $-(-x) = x$, for example. Such linear transformations are called reflections, and as we will see later, we've got reason to believe that reflections will take us all the way.
So, we consider the set of all linear transformations $L : \mathbb R^3 \to \mathbb R^3$ which satisfy $N(L(x,y,z)) = N((x,y,z))$ for all $(x,y,z) \in \mathbb R^3$. Algebraically speaking, this is a group under composition, because if $L,L'$ are in this set , then so is $LL'$ , and furthermore every such linear transformation is in fact invertible (prove this using the rank-nullity theorem!).
Now, because linear transformations correspond to matrices, we are talking about a very specific subgroup of the group of invertible $3 \times 3$ matrices over the reals. The group is called the group of orthogonal matrices with respect to the bilinear form $\langle \cdot,\cdot\rangle$, and is denoted for us by $O$.
So the point of this setting, is that you change your bilinear form and your lattice, then you are entitled to study $O$ for the new setting. But what about $O$ do you want to study?
Well, expecting the symmetry of the lattice to permeate to the symmetry of $O$, you want to hope that you can build any element of $O$ from some base elements of $O$, just like how a lattice is built up. That is, find a set of matrices that generate $O$. Even better would be to get a presentation of $O$ (which is an exact statement about how these generators interact with each other) but we leave this out of our discussion.
Reflections
Let $w = (x,y,z) \in \mathbb R^3$ be such that $N(w) \neq 0$. Then, we can define a reflection about the plane orthogonal to the line joining $w$ and the origin as follows : $$ s_w(v) = v - \frac{2 \langle v,w\rangle}{\langle w,w\rangle}w $$ This is an actual reflection if you take your usual inner product and so on, so it makes sense here as well.
This reflection has certain properties that are nice (the third one is key), which we list for convenience :
-
$s_w(w) = -w, s_w(v) = 0$ for $\langle v,w\rangle =0$.
-
It is a linear transformation!
-
It preserves norm : $N(s_w(v)) = N(v)$ for all $v$.
-
$s_w(s_w(v)) = v$ for all $v$.
How lovely! So we've got candidate generators for our set of matrices $O$, at least they are norm preserving! But the point is, why do we expect these to get everywhere?
Well, the answer to that is a bit complicated, and stems from the idea that we can reduce $N$ by applying appropriate linear transformations. A theorem of Cartan and Dieudonne would, in this setting, say :
Every element of $O$ is a product of at most three reflections i.e. for every $A \in O$ there exist $w_1,w_2,w_3 \in \mathbb R^3$ such that $A = s_{w_1}s_{w_2}s_{w_3}$.(Note : if there are too many $w_i$ for a certain $A$, you can take $w_i = 0$ for example, then $s_{0}=I$ so this statement is true as written).
This tells us that reflections are what we should be looking for. Now, what kind of reflections should we be looking for?
Well, simple ones. Three of them given by $w = (1,0,0),(0,1,0),(0,0,1)$ are the three I listed earlier, which send each component to its negative and fix the others. Call these $s_x,s_y,s_z$.
There's another nice one switching $x$ and $y$, call it $s_{xy}$ given by $w = (1,1,0)$. Then there's $s_{xyz}$ given by $w = (1,1,1)$. They will have associated matrices you can easily calculate from the formula for reflections.
The way these are chosen, you are basically hoping to perform finite descent.
The main lemma and descent
It turns out the $s_i$ we wrote earlier were good enough!
Let $N((a,b,c)) = -1$. Then, in some order, the transformations $s_{i}$ may be applied (for $i \in \{x,y,z,xyz\}$, so $s_{xy}$ is left out), so that $(a,b,c)$ is mapped to $(0,0,1)$ by this sequence of reflections. As a corollary, there is an element of $O$ which sends $(a,b,c)$ to $(0,0,1)$.
Proof : First, we leave as an exercise the following expressions for the $s_i$ : $$ s_{x}(a,b,c) = (-a,b,c) s_{y}(a,b,c) = (a,-b,c) s_z(a,b,c) = (a,b,-c) s_{xyz}(a,b,c) = (-x-2y+2z,-2x-y+2z,-2x-2y+3z) $$
We also remark at this point that the $s_{i}$ are invertible linear transformations and therefore preserve gcd, in the sense that if $(x,y,z)$ have gcd $1$ then so do the components of $s_i(x,y,z)$.
Now, we use descent. First, note that we can transform $(a,b,c)$ to $(|a|,|b|,|c|)$ using $s_x,s_y,s_z$, so we assume WLOG that $a,b$ are non-negative.
From this, we get two inequalities : the first is that $|c| > a,b$, quite clearly. The second , IF $a,b > 1$, comes from : $$ c^2 = a^2+b^2+1 < a^2+b^2 + 2ab = (a+b)^2 $$
and therefore $|c| < a+b$.
Suppose $a,b > 1$ then applying $s_{xyz}$ to $(a,b,c)$ gives us the third component as $-2a-2b+3c$, and if $a,b > 1$, it can be seen that $-c < -2a-2b+3c < c$ , since $|c| < |a|+|b|$ and you can just adjust this to see that both sides work out. Thus, applying $s_{xyz}$ reduced the absolute value of the third component. Following this , we non-negativize and proceed again. So we keep applying $s_{x,y,z}$ until one of $a,b$ is smaller than $2$. (which as a thought of its own is going to be really useful as we see later).
However, if either $a<2$ or $b<2$ , then we need to check what occurs. If $a = 1$ or $b=1$ then we'd get two squares differing by two, which is impossible. If either one equals $0$ then you'd have two squares differing by $1$ ,which leavea only the possibility that one of them is zero and the other is $\pm 1$. Following an application of $s_z$ (if necessary) we reach $(0,0,1)$, completing the task. $\blacksquare$
That's our result! We have proven, that every solution is reachable from $(0,0,1)$ via a sequence of reflections. (Note : we didn't actually use $s_{xy}$, and it turns out that $s_{xy}$ is only needed in a more general setting).
More importantly, note that we have a procedure for doing this as follows : taking a solution, we non-negativize every entry, then apply $s_{xyz}$ and non-negativize again, and keep going till we hit $(0,0,1)$. Then, because reflections are inverses of themselves, we could just take the reflections to the other side algebraically, and obtain the ascent representation of this solution.
For example, let's take a solution to this equation, say $(2,2,3)$. Then we apply $s_{xyz}$ to this to get : $(0,0,1)$! So it turns out that $(2,2,3) = s_{xyz}(0,0,1)$.
Now let's take a larger solution, say $(34,38,51)$. First apply $s_{xyz}$, it is $(-8,-4,9)$. Non-negativize to get $(8,4,9)$, then apply $s_{xyz}$, it is $(2,-2,3)$ and you can see what to do from here!
Let's take $(70,70,99)$ (recall Pell equations for how I found this one). Apply $s_{xyz}$ to get $(-12,-12,17)$, then non-negativize to get $(12,12,17)$, then $s_{xyz}$ again to get $(-2,-2,3)$ etc.
One last : let's take $(82,122,147)$. Apply $s_{xyz}$ and non-negativize to get $(32,8,33)$. Apply $s_{xyz}$ and non-negativize to get $(18,6,19)$, and again to get $(8,4,9)$, we've been here before!
And so on. So, in short :
$s_{xyz}$ and non-negativize. $s_{xyz}$ and non-negativize. Repeat till you get to $(0,0,1)$ , and then breathe.
Finding patterns and conclusions
We can find iterative patterns quite nicely.
Take say $(s_xs_{xyz})^n[0,0,1]^T$, that's a pattern. Take say $(s_{x}s_{y}s_{xyz})^n [0,0,1]^T$, that's a pattern.
Now, these patterns are different from those presented in others, in the sense that they grow exponentially in $n$ rather than, say quadratically. However, we have some kind of general solution as well : See if you can attempt to solve for $x^2+y^2 = z^2-t$ for $t>0$ using the given methods.
For example, let's try to prove that every solution for $x^2+y^2 = z^2-2$ can be built up using $s_x,s_y,s_z,s_{xyz}$ from $(1,1,2)$. (Hint : when does the descent stop? When the inequality $|c| < a+b$ doesn't hold. When does it not hold? When $2ab \leq 2$, now these cases must be considered separately) I'll leave the full answer in the hidden box below.
So if $2ab>2$ then $|c|<a+b$ and we can continue doing $s_{xyz}$ and non-negativizing. If not, then $ab \leq 1$ so we only have the following possibilities by symmetry : either $a= 0$ or $a=1,b=1$. Indeed, if $a=1,b=1$ then $c=2$ works. If $a=0$ then $b^2 = c^2-2$ has no solutions. Therefore, the descent stops precisely when we hit $(1,1,2)$, which means that starting from $(1,1,2)$ we can go anywhere!
Now try this for $x^2+y^2 = z^2-3$, and once again I'll leave the answer below. There's a small catch, because $s_{xy}$ is going to get involved as well.
The same : $2ab \leq 3$ only when $ab \leq 2$, so either $a=0$, or $a=1,b=1$ or $a=1,b=2$. If $a=0$ then $b^2 = c^2-3$ has only $b=1,c=2$ as a solution. $a=1,b=1$ then $c^2 = 5$, and if $a=1,b=2$ then $c^2=8$, neither of which work out. So the descent stops precisely when we hit $(0,1,2)$ OR $(1,0,2)$, so every solution can be built up from $(0,1,2)$ OR $(1,0,2)$. But $s_{xy}$ will help go between these transformations because $s_xs_{xy}(0,1,2) = (1,0,2)$, so basically IF we include $s_{xy}$, then we can build all solutions from $(0,1,2)$!
Maybe you see how this works for the general case now as well. This method is super-beneficial : note that if you can get good reflections that allow you to perform descent, then you can actually solve this question for a lot of bilinear forms!
Furthermore, if one is allowed to bring in lattices from algebraic number theory (so that rationally independent quantities would be along different axes of the lattice) then this argument can be given a really different flavour and help us obtain many, many more interesting results along this line.
Summary
-
Understanding the equivalence of our problem with norm fixation.
-
Studying lattices and bilinear forms.
-
Why linear transformations(particularly reflections) are likely to fix the norm.
-
A descent argument.
-
Generalization for some other cases of the Diophantine equation.
I'm not sure this is the type of solution you were looking for, since it's not a parametrization like we have for the Pythagorean triples, but it's similar to the one you posted to the equation with the positive sign it just takes a little more work with the factorization.
From the solution $(0,0,1)$, trace the line $\{(t,pt,qt+1)|t\in\mathbb{R}\}$. Notice that by varying $p,q,t$ we get all points in $\mathbb{Q}^3$, so fix $p,q$ and solve for $t$
$$t^2+p^2t^2=(qt+1)^2-1$$
$$t=\frac{2q}{1+p^2-q^2}.$$
Therefore all other solutions are of the form $\left(\frac{2q}{1+p^2-q^2},\frac{2pq}{1+p^2-q^2},\frac{1+p^2+q^2}{1+p^2-q^2}\right)$ for $p,q\in\mathbb{Q}$. You can let $p=\frac xz$, $q=\frac yz$ and you have that the solutions are of the form
$$\left(\frac{2yz}{z^2+x^2-y^2},\frac{2xy}{z^2+x^2-y^2},\frac{x^2+y^2+z^2}{z^2+x^2-y^2}\right)$$
for integers $x,y,z$, you just have to require these to be integers.
This is only a partial answer. I managed to find several families of solutions:
Family 1
$$ \begin{align} a &= 2\left[(4k^2+1)n \pm k\right],\\ b &= 2\left[(4k^2+1)n^2 \pm 2kn - k^2\right],\\ c &= 2\left[(4k^2+1)n^2 \pm 2kn - k^2\right] + 4k^2 + 1. \end{align} $$
Family 2
$$ \begin{align} a &= 2\left[\left(2k(k+1)+1 \vphantom{1^1} \right)n \pm k^2\right],\\ b &= 2\left[\left(2k(k+1)+1 \vphantom{1^1} \right)n^2 \pm 2k^2n - k\right],\\ c &= 2\left[\left(2k(k+1)+1 \vphantom{1^1} \right)n^2 \pm 2k^2n - k\right] + 2k(k+1)+1. \end{align} $$
Here, $k$ and $n$ are integers such that $a,b,c$ are positive integers.
I also found solutions for which I have not yet found a generalization:
$$ 2(29n\pm 6),\quad 2(29n^2 \pm12n -6),\quad 2(29n^2 \pm12n -6) +29,\\ 2(53n\pm15),\quad 2(53n^2\pm30n -9),\quad 2(53n^2\pm30n -9) + 53,\\ 2(73n\pm23),\quad 2(73n^2\pm46n - 11),\quad 2(73n^2\pm46n - 11) + 73. $$
EDIT
I found a recursion: if $(a, b, c)$ is a solution to $a^2 + b^2 = c^2 - 1$, then the three triples
$$ \begin{align} a' &= 2(a+c-b) - a\\ b' &= 2(a+c-b) + b\\ c' &= 2(a+c-b) + c, \end{align} $$
$$ \begin{align} a' &= 2(b+c-a) - b\\ b' &= 2(b+c-a) + a\\ c' &= 2(b+c-a) + c,\\ \end{align} $$
$$ \begin{align} a' &= 2(a+b+c) - b\\ b' &= 2(a+b+c) - a\\ c' &= 2(a+b+c) + c,\\ \end{align} $$ are all solutions as well. Starting with the trivial solution $(0,0,1)$, I'm reasonably confident that this will generate all solutions. Unfortunately, I haven't found a closed-form expression.