Number Theory – Why Certain Cases are Impossible for Mengoli’s Six-Square Problem

diophantine equationselementary-number-theorypythagorean triplessquare-numberssums-of-squares

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 parallel CPU processing (GitHub). In a fairly short time (using a heavy CPU server), I was able to generate data up to the 12 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 CPU 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.

Best Answer

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)