# A solution to a Diophantine equation with three unknowns (similar to the Fermat Theorem)

I need to either solve the following Diophantine equation with three unknowns:

$n_{1} (n_{1} +1) \pm n_{2} (n_{2} +1) \pm n_{3} (n_{3} +1) = 0$,

where $n_{1,2,3}$ can be positive or negative -- or perhaps prove that this equation doesn't have a solution other than the trivial one

$n_{1} = 0,\hspace{5mm} n_{2} = n_{3}$

plus the obvious permutations.

Given that this equation looks pretty much like the one in the Fermat Theorem, I personally think that the latter is more plausible.

• The equation is not at all as Fermat's. If anything it is like the Pythagorean one (that is exponent $2$, so $x^2 + y^2 = z^2$)
– quid
Commented Aug 14, 2016 at 21:56
• here is the one from yesterday math.stackexchange.com/questions/1891139/… Commented Aug 14, 2016 at 23:15
• Commented Aug 15, 2016 at 4:17

Here is an answer to the question as originally posted. Later on, the OP has somewhat displaced the goalposts.

If $n$ is an integer, no matter what its sign is, then $n(n-1)$ will be either zero or positive, with zero exactly if $n=0$ or $n=1$.

Since neither of the terms in your equation can be negative, the only way for the entire thing to be zero is if each term is zero, so you have exactly $8$ solutions, corresponding to each combination of $n_1,n_2,n_3\in\{0,1\}$.

The numbers of the form $n(n+1)$ are $$0, 2, 6, 12, 20, 30, \ldots$$ Their differences are the successive even numbers, and since all the numbers are themselves even, we can just pick one of them and express it as the difference of two others, for example $$3(3+1) + 5(5+1) - 6(6+1) = 0$$ and in general we have solutions of the form $$n_1 \in \mathbb Z, \qquad n_3 = \frac{n_1(n_1+1)}2, \qquad n_2 = n_3-1$$ This doesn't exhaust the solutions; we also have, for example $$5(5+1) + 6(6+1) - 8(8+1) = 0$$ $$9(9+1) + 13(13+1) - 16(16+1) = 0$$ $$11(11+1) + 14(14+1) - 18(18+1) = 0$$
Ummm. Since $n(n+1) \geq 0,$ it is necessary to have final form $$n_1(n_1 + 1) = n_2(n_2 + 1) + n_3(n_3 + 1)$$ to get anything worthwhile. Multiply through by $4,$ add $2$ to both sides. The result is $$x^2 + 1 = z^2 + w^2,$$ with $x,z,w$ odd. The solutions to this, all of them, are parametrized by the modular group. take integers $a,b,c,d$ with $$ad - bc = 1.$$ Then take $$x = ab + cd; \; \; z = ab - cd; \; \; w = ad + bc$$ with the restriction the $x,z,w$ must be odd. Then let $$n_1 = \frac{x-1}{2}, \; \; n_2 = \frac{z-1}{2}, \; \; n_3 = \frac{w-1}{2}.$$ This means, with $ad-bc = 1,$ $$n_1 = \frac{ab + cd-1}{2}, \; \; n_2 = \frac{ab - cd-1}{2}, \; \; n_3 = \frac{ad + bc-1}{2}.$$
If we do not restrict $y,$ just say $x^2 + y^2 = z^2 + w^2,$ with $x$ largest and $x \equiv z \pmod 2,$ we can parametrize all solutions in the same manner, just add $y = ad - bc.$ To get all entries positive we can even take $a > c > 0,$ $b > d > 0,$ and $ad \geq bc.$ I had a certain amount of repetition removed from this printout. There are some repeats left.
jagy@phobeusjunior:~$./two_pair | sort -n x^2 + y^2 = z^2 + w^2 x y z w a b c d 5 0 3 4 2 2 1 1 7 1 5 5 3 2 1 1 8 1 4 7 2 3 1 2 // a > c ; b > d ; 9 2 7 6 4 2 1 1 // a d >= b c 11 2 5 10 2 4 1 3 // x = a * b + c * d 11 3 9 7 5 2 1 1 // y = a * d - b * c 12 1 8 9 5 2 2 1 // z = a * b - c * d 13 0 5 12 3 3 2 2 // w = a * d + b * c 13 1 11 7 4 3 1 1 13 4 11 8 6 2 1 1 14 3 6 13 2 5 1 4 14 5 10 11 4 3 1 2 15 5 13 9 7 2 1 1 16 3 12 11 7 2 2 1 17 0 15 8 4 4 1 1 17 1 13 11 3 5 1 2 17 4 7 16 2 6 1 5 17 6 15 10 8 2 1 1 17 7 13 13 5 3 1 2 18 1 10 15 2 7 1 4 18 1 6 17 3 4 2 3 19 2 13 14 8 2 3 1 19 3 17 9 6 3 1 1 19 4 11 16 5 3 2 2 19 7 17 11 9 2 1 1 19 8 13 16 4 4 1 3 20 5 16 13 9 2 2 1 20 5 8 19 2 7 1 6 20 9 16 15 6 3 1 2 21 1 19 9 5 4 1 1 21 2 11 18 2 8 1 5 21 8 19 12 10 2 1 1 x y z w a b c d x^2 + y^2 = z^2 + w^2  • It looks like the answer to my question – thanks a lot (and to Henning too). Just one thing: why are you sure that these are the only solutions? Commented Aug 14, 2016 at 22:44 • @EugeneB fairly long proof by MSE standards. There is an intimate relationship between the integer quaternary quadratic forms$x^2 + y^2 - z^2 - w^2$and$st - uv.$All primitive solutions of$st=uv$can be written as$s = \alpha \beta, t = \gamma \delta, u = \alpha \delta, v = \beta \gamma\$ Commented Aug 14, 2016 at 22:49