10

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.

Eldar Sultanow
  • 1,678
  • 7
  • 19
  • 1
    You can assume that the numbers in the tuple are coprime (not meant as pairwise coprime) : If $p$ is a common prime divisor , we get another solution by dividing all the numbers by $p$. This should accelerate the search drastically. – Peter Dec 26 '21 at 12:34
  • Thank you very much. I will try this. Could this be a valid argumentation?: Suppose $p^2+w^2=x^2$ and $q^2+w^2=y^2$. If $y^2-x^2=s^2$, then $q^2-p^2=s^2$. Let $w=2de$ where $d$ and $e$ are relatively prime and of opposite parity and $p=d^2-e^2$ and $x=d^2+e^2$ and $s=2fg$ where $f$ and $g$ are relatively prime and of opposite parity so $x=f^2-g^2$ and $y=f^2+g^2$. Then $d^2+e^2+g^2=f^2$. Suppose $d$ and $g$ are odd, then $d$ and $g$ are of the form $8k+1$ (this is well known) so that $d^2+g^2$ is of the form $8k+2$ and $e^2$ and $f^2$ are of the form $4j$, so there can be no solutions. – Eldar Sultanow Dec 26 '21 at 12:47
  • Small additional note: The square of an odd integer is (well known) of the form $8k+1$. Considering $d,e,f,g$ two of them have to be odd and two have to be even for reduced Pythagorean triples. We assume $d$ and $g$ are the odd ones. If this argumentation holds, then we would have demonstrated that no quadruples $(w,x,y,z)$ exist whose differences $z^2-y^2\ldots x^2-w^2$ are again squares? This seems to be too trivial - do I am missing something here? – Eldar Sultanow Dec 26 '21 at 12:55
  • 1
    I do not think that it is so easy because not all the occuring triples need to be primitive. I tried an approach to define $s:=x^2-w^2$ , $t:=y^2-x^2$ , $u:=z^2-y^2$, so the numbers are $s,t,u,s+t,t+u,s+t+u$ , but a trial to show that they cannot all be perfect squares led to nowhere. – Peter Dec 26 '21 at 12:56
  • Very good point! I will now optimize the code so that we systematically check triples $(p\cdot x,p\cdot y,p\cdot z)$. – Eldar Sultanow Dec 26 '21 at 13:03
  • @Peter: Do these (non-primitive) solutions provide a larger search space increasing the chance to find such a quadruple? I found tons of "almost solutions" such as for example $(w,x,y,z)=(495,975,1073,1105)$. Here it only fails at $z^2-w^2=1105^2-495^2=976000=10^2\cdot2^2\cdot2^2\cdot2\cdot5\cdot61$. We may use the trick to multiply the quadruple with an integer $p$ to get $(p\cdot w,p\cdot x,p\cdot y,p\cdot z)$. To "heal" that "almost solution" $p$ must be $\sqrt{2\cdot5\cdot61}$. For any "almost solution" $p_1^2\cdots p_n^2p_{n+1}\cdots$ we must use the factor $\sqrt{p_{n+1}\cdots}$ – Eldar Sultanow Dec 26 '21 at 15:51
  • 1
    @Peter: I could generate 6-tuples of perfect squares $(s,t,u,t+u,t+u-s,t-s)$ according your approach :-). It is still running in the cluster. Here are two examples [23409, 34225, 451584, 485809, 462400, 10816] and [270400, 284089, 571536, 855625, 585225, 13689]. Now I have to solve $s=x^2-w^2$, $t=y^2-w^2$, $u=z^2-y^2$, and so on. Question: I am allowed to assume $s<t$ but not necessarily $t<u$. For example: [451584, 462400, 23409, 485809 , 34225 , 10816]? – Eldar Sultanow Dec 27 '21 at 12:25

3 Answers3

3

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)
  • Thank you for this very valuable hint. It allows me to accelerate still further the search algorithm. Maybe in a larger number range some solutions will occur. – Eldar Sultanow Dec 28 '21 at 13:40
  • You mean "in which case $w/4,x/4,y/4,z/4$ is a smaller solution", right? – Mike Dec 30 '21 at 20:46
3

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.

Haran
  • 11,978
  • 1
  • 19
  • 56
1

(A long comment to connect the OP's post to Euler bricks.)

Solving Mengoli's Six-Square Problem is equivalent to finding a face cuboid (following Randall Rathbun's terminology). That is, whereas a Euler brick has the space diagonal as irrational, a face cuboid has one face diagonal as irrational.

To illustrate, we label the OP's largest solution given above,

$$(\color{blue}x, a, \color{blue}y, b, c, \color{blue}z) = (5784576,895232,5853440,1317024,1592480,5999776)$$

hence the six numbers obey,

$$-x^2+y^2 = a^2\\ -y^2+z^2=b^2\\ -x^2+z^2=c^2$$

But it is also true that,

$$a^2+b^2 = c^2\\ a^2+x^2=y^2\\ a^2+b^2+x^2=z^2$$

hence $(a,b,x)$ are the rational edges of a Euler cuboid, but one face diagonal is irrational,

$$b^2+x^2 = \big(25824\sqrt{52777}\big)^2$$

P.S. Rathbun has a database with terms going up to $10^{10}$.

  • Thank you for this geometrical explanation. If we could sieve out impossible samples in our quest for quadruples $(w,x,y,z)$ that solve the Mengoli's Six-Square Problem, it would be amazing and I will implement an optimized tool. – Eldar Sultanow Feb 09 '25 at 08:27
  • 1
    @EldarSultanow Technically, Mengoli’s Six Square Problem needs only $(x,y,z)$, adding the variable $w$ makes it more challenging. There is a possibility that the addition of $w$ makes it equivalent to the “perfect Euler brick” problem, which has tentative proofs of having NO solutions. What would be also interesting is finding “smallish” solutions$(w,x,y,z)$ such that 5 out of 6 are squares. Can you generate a database for that? – Tito Piezas III Feb 09 '25 at 09:02
  • 1
    I will! I remember having already code for that. – Eldar Sultanow Feb 09 '25 at 09:15