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.

  • $\begingroup$ $w$ - ?????????? $\endgroup$ – individ Jun 30 '19 at 11:49
  • 1
    $\begingroup$ Can some vars be zero? $\endgroup$ – coffeemath Jun 30 '19 at 11:59
  • $\begingroup$ no, I'll update it $\endgroup$ – M. Świderski Jun 30 '19 at 12:02
  • $\begingroup$ The most efficient way to find these (programmatically of course) is to use the formulas for finding triples given one number $\endgroup$ – poetasis Jul 1 '19 at 18:32
  • $\begingroup$ I'll give a parametric solution in a day or two. (Too sleepy now.) $\endgroup$ – 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
   for a from 1 to w do
     if(issqr(w^2-a^2)) then 
   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 
           if(y>0) then print(x,y,z,s,t,w); fi:
       end do:   
     end do:
 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
  • $\begingroup$ I added context for this problem in the edit. $\endgroup$ – M. Świderski Jun 30 '19 at 12:52
  • $\begingroup$ I've added the parametric solution in my answer. The OP's problem is just a version of Mengoli's Six-Square Problem. $\endgroup$ – Tito Piezas III Jul 7 '19 at 6:53
  • 1
    $\begingroup$ I've asked a related post. It may be amenable to your computer program. $\endgroup$ – 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)$$


$$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.

  • $\begingroup$ 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. $\endgroup$ – M. Świderski Jul 7 '19 at 12:05
  • $\begingroup$ @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.) $\endgroup$ – 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.





Then the solutions are of the form:












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.