# Solutions to a system of three equations with Pythagorean triples

Is there any solution to this system of equations where $$x,y,z,s,w,t\in\mathbb{Z}$$, none are $$0$$. \begin{align*} x^2+y^2=z^2\\\ s^2+z^2=w^2\\\ x^2+t^2=w^2 \end{align*}

EDIT: Thank you zwim for the answer. Maybe I should explain where this came from. Well these six numbers correspond to another four numbers $$a,b,c,d\in\mathbb{Z}$$ in such a way that if you take any two numbers among $$a,b,c,d$$ their difference produces a perfect square. There is six pairs so it corresponds to finding six perfect squares that satisfy the system of equations above. In the end we have a set of numbers that all differ between each other by a perfect square. I now wonder if there is a set of five numbers with such a property.

• $w$ - ?????????? – individ Jun 30 '19 at 11:49
• Can some vars be zero? – coffeemath Jun 30 '19 at 11:59
• no, I'll update it – M. Świderski Jun 30 '19 at 12:02
• The most efficient way to find these (programmatically of course) is to use the formulas for finding triples given one number – poetasis Jul 1 '19 at 18:32
• I'll give a parametric solution in a day or two. (Too sleepy now.) – Tito Piezas III Jul 4 '19 at 16:41

The solutions has to be found among $$w$$ that has multiple Pythagorean triples solutions.

Three primitive Pythagorean triples with the same c

So it was not a surprise to see solutions with $$1105$$ which has four triplets, according to post above.

Anyway, I don't know for a closed form, but at least some solutions exists, I have listed a small list below, obtained by programming.

for w from 1 to 2000 do
count:=0;
for a from 1 to w do
if(issqr(w^2-a^2)) then
count:=count+1;
A[count]:=a;
B[count]:=sqrt(w^2-a^2);
fi:
end do:
if(count>1) then
for i from 1 to count do
for j from 1 to count do
if(i=j) then next; fi:
x:=A[i]; t:=B[i];
s:=A[j]; z:=B[j];
if(issqr(z^2-x^2)) then
y:=sqrt(z^2-x^2);
if(y>0) then print(x,y,z,s,t,w); fi:
fi:
end do:
end do:
fi:
end do:

153, 104, 185, 672, 680, 697
672, 104, 680, 153, 185, 697
520, 117, 533, 756, 765, 925
756, 117, 765, 520, 533, 925
448, 840, 952, 495, 975, 1073
495, 840, 975, 448, 952, 1073
264, 495, 561, 952, 1073, 1105
264, 448, 520, 975, 1073, 1105
952, 495, 1073, 264, 561, 1105
975, 448, 1073, 264, 520, 1105
306, 208, 370, 1344, 1360, 1394
1344, 208, 1360, 306, 370, 1394
1040, 234, 1066, 1512, 1530, 1850
1512, 234, 1530, 1040, 1066, 1850

• I added context for this problem in the edit. – M. Świderski Jun 30 '19 at 12:52
• I've added the parametric solution in my answer. The OP's problem is just a version of Mengoli's Six-Square Problem. – Tito Piezas III Jul 7 '19 at 6:53
• I've asked a related post. It may be amenable to your computer program. – Tito Piezas III Jul 8 '19 at 4:03

I. The edit of the OP suggests that the context of the problem is to find 4 numbers $$a>b>c>d$$ such that the difference of any two is a square, $$a-b=x^2\\ a-c =z^2\\ a-d=w^2\\ b-c=y^2\\ b-d=t^2\\ c-d=s^2$$

Solving the first 3 eqns for $$b,c,d$$ and plugging those into the last 3 eqns, we recover the OP's system,

$$x^2+y^2=z^2\\ x^2+t^2=w^2 \\ s^2+z^2=w^2$$

Solving for $$s,t,y$$,

$$s = \sqrt{w^2-z^2}\\ t = \sqrt{w^2-x^2}\\ y = \sqrt{z^2-x^2}$$

Thus, the real problem is to find three squares $$w^2,z^2,x^2$$ such that the difference between any two is also a square.

This is one version of the centuries-old problem called Mengoli-Six Square Problem, or MSP. A parametric solution can be given as,

$$w = (e^2+f^2)(g^2-h^2)\\ z =(e^2-f^2)(g^2+h^2)\\ x= (e^2-f^2)(g^2-h^2)$$

where,

$$e = 4q\\ \quad\quad f = \sqrt{p^2+(3q)^2}\\ g = 4pq\\ h=p^2+5q^2$$

It is easy to find rational $$f$$ since it is just a Pythagorean triple in disguise. So one small solution is $$p = 4, q=1$$ which yields,

$$w,z,x = 7585, 6273, 1665$$ $$s,t,y = 4264, 7400, 6048$$

and infinitely many more.

• According to your formula f is squared anyway so there isn't any square root there actually. Thus I don't think the fact that f is rational or not matters. – M. Świderski Jul 7 '19 at 12:05
• @M.Świderski: Good observation. However, the variables $w,z,x$ are just one half of the problem. The other half is $s,t,y$, and $y$ is a rational only if $f$ is rational. (I didn't bother writing their formulas as it is rather tedious.) – Tito Piezas III Jul 7 '19 at 17:05

Time... began to write, and I will add a few words....

Do there exist four distinct integers such that the sum of any two of them is a perfect square?

This is equivalent to solving the following system of equations:

\left\{\begin{aligned}& b+a=x^2 \\&b+c=y^2\\&b+f=z^2\\&a+c=e^2\\&a+f=j^2\\&c+f=p^2\end{aligned}\right.

Let: $$F,T,R,D$$ - any asked us integers.

For ease of calculation, let's make a replacement.

$$q=(8F^2+4FT-T^2)R^2+2(T+2F)RD-D^2$$

$$k=(8F^2+8FT+2T^2)R^2+2(T+2F)RD$$

$$s=-T^2R^2+2(T+2F)RD-D^2$$

$$t=(8F^2+12TF+3T^2)R^2+2(T+2F)DR-D^2$$

Then the solutions are of the form:

$$x=s^2+k^2-t^2+2(t-k-s)q$$

$$y=t^2+k^2-s^2+2ks-2tk$$

$$z=s^2+k^2-t^2$$

$$e=t^2+k^2+s^2-2kt-2ts$$

$$j=t^2+s^2-k^2+2ks-2ts$$

$$p=3s^2+3k^2+3t^2-6kt-6st+8ks+2(t-k-s)q$$

$$b=\frac{x^2+y^2-e^2}{2}$$

$$a=\frac{e^2+x^2-y^2}{2}$$

$$c=\frac{e^2+y^2-x^2}{2}$$

$$f=\frac{2z^2+e^2-x^2-y^2}{2}$$