For integers $x<y<z$, why are these cases impossible for Mengoli's Six-Square Problem?

I got inspired by this question "Four squares such that the difference of any two is a square?" and rewrote zwim's program that is provided by his answer to the question "Solutions to a system of three equations with Pythagorean triples" using python and optimized it for GPU (GitHub). In a fairly short time (using a heavy GPU server), I was able to generate data up to the 6 million range, see CSV File. Let us take a short look at this data set. The first and last lines are:

153,104,185,672,680,697
...
5784576,895232,5853440,1317024,1592480,5999776

We have $(x,y,z)=(5784576,5853440,5999776)$ and indeed all differences $z^2-y^2=1317024^2$, $z^2-x^2=1592480^2$ and $y^2-x^2=895232^2$ are again squares.

My idea was the following: For all triples $(x,y,z)$ with $x<y<z$, whose differences $z^2-y^2$, $z^2-x^2$ and $y^2-x^2$ are again squares, let us search a fourth integer $w<x$ such that $z^2-w^2$, $y^2-w^2$, $x^2-w^2$ are again squares. For this I wrote another GPU optimized program (GitHub) and let it perform the search using the same heavy GPU resources. Sadly, even up to large integers there is no solution.

What I found out are the following behaviors:

  1. If $x,y,z$ are all odd, then $(x^2+y^2+z^2)\equiv3\pmod{8}$. This is well-known and a proof for this exist.
  2. If only $z$ is odd, then $(x^2+y^2+z^2)\equiv1\pmod{8}$.
  3. If only $y,z$ are odd, then $(x^2+y^2+z^2)\equiv2\pmod{8}$.

The following cases seem to be impossible, they never appear in my data set (and maybe cannot happen in general?):

  1. Only $y$ is odd.
  2. Only $x$ is odd.
  3. Only $x,z$ are odd.
  4. Only $x,y$ are odd.

My questions:

Can these behaviors be proven and (more interestingly) do they help in demonstrating that quadruples $(w,x,y,z)$ with $w<x<y<z$ do not exist, whose differences $z^2-y^2,\ldots,x^2-w^2$ are squares again?

My intention / next steps (hopefully with your help)

I initiated a larger run (up to the range of $20,000$) in that GPU cluster, it is still running and will really take longer.

Since I am eager in such kind of programming/explorations: Please let me know if I should adjust my search or should I look for another pattern or ammend my program to move forward more efficiently and further on this really exciting topic.

Update (2021-12-28)

According to the useful hint of Peter I implemented a search for $6$-tuples of squares $(s,t,u,t+u,t+u-s,t-s)$ with the intend to find quadruples $(w,x,y,z)$ by the following system:

  • $x^2-w^2=s\qquad z^2-w^2=t+u$
  • $y^2-w^2=t\qquad z^2-x^2=t+u-s$
  • $z^2-y^2=u\qquad y^2-x^2=t-s$

I found $6$-tuples up to $s=20448484$, see TXT File (script is still running). Here is a cutout of the data, where each row contains a tuple $(\sqrt{s}, \sqrt{t}, \sqrt{u}, s,t,u,t+u,t+u-s,t-s)$:

153,185,672,23409,34225,451584,485809,462400,10816
306,370,1344,93636,136900,1806336,1943236,1849600,43264
...
3672,4440,16128,13483584,19713600,260112384,279825984,266342400,6230016
2112,4488,7616,4460544,20142144,58003456,78145600,73685056,15681600
2856,4550,5280,8156736,20702500,27878400,48580900,40424164,12545764
4522,4550,5280,20448484,20702500,27878400,48580900,28132416,254016

Then I imported this file into Mathematica and searched solutions for $(w,x,y,z)$:

arr = Import["C:/Users/esultano/git/pythagorean/pythagorean_stu.txt", 
   "CSV", "HeaderLines" -> 0];
f[i_] := Part[arr[[i]], 1 ;; 3];
len = Length[arr];
For[i = 1, i < len, i++, {
  triplet = f[i];
  s = triplet[[1]];
  t = triplet[[2]];
  u = triplet[[3]];
  Print[FindInstance[
    x*x - w*w == s*s && y*y - w*w == t*t && w != 0, {w, x, y}, 
    Integers]];
  Print[FindInstance[
    y*y - w*w == t*t && z*z - y*y == u*u && w != 0, {w, y, z}, 
    Integers]];
  }
 ]

Without success. Maybe taking a closer look at these tuples will help.


Squares can only be 0 or 1 module 4. Hence, if $a^2-b^2$ is a square then we cannot have $a$ even and $b$ odd. Hence if $w<x<y<z$ and all larger squares minus smaller squares are squares, then we cannot have an odd followed by an even. In other words, we must have one of

  • all are odd
  • only $w$ is even
  • only $w, x$ are even
  • only $w,,x,y$ are even
  • all are even (in which case $w/2, x/2,y/2,x/2$ is asmaller solution)

To see why all the solutions show the behavior you spotted, note that the cases which got eliminated are precisely the solutions where you can substitute two values from $x,y,z$ for the variables $a,b$ such that $a$ is even, $b$ is odd, and $a^2-b^2$ is a perfect square. However: $$a^2-b^2 \equiv 0-1 \equiv 3 \pmod{4}$$ which is a contradiction since $a^2-b^2$ is a square and cannot be congruent to $3 \bmod{4}$ since $3$ is a quadratic non-residue modulo $4$.

Next, we can observe the cases which do occur. All odd squares are $1 \bmod{8}$, and what you want to show in all three cases is that all the even squares are $0 \bmod{8}$. Assume the contrary, let there exist an even square which is $4 \bmod{8}$. Then, we can substitute two of $x,y,z$ for variables $a,b$ such that $a^2-b^2$ is a perfect square and precisely one of $a,b$ is odd. However: $$a^2-b^2 \equiv \pm(4-1) \equiv \pm 3 \pmod{8}$$ which is a contradiction since $a^2-b^2$ is an odd square and cannot be $\pm 3 \bmod{8}$.

It is unlikely that these parity observations can help resolve the original problem. What we know is that all the odd values among $w,x,y,z$ are greater than all the even values, which still leaves $4$ parity cases.