## Four Squares from Three Numbers

```Diophantus posed the problem of finding three rational numbers a,b,c
such that ab+1, ac+1 and bc+1 are each squares, and this problem has
been extended and generalized (and specialized) in several different
ways by later mathematicians.  For example, Euler found sets of four,
and one set of FIVE, rationals numbers such that each of the pairwise
products is one less than a square.  A discussion of this general
problem can be found in If ab+1, ac+1, bc+1 are squares....  There's
also an article in the Feb 98 Mathematics Magazine on this subject.

Anyway, John Gowland recently proposed a slightly different extension
of this problem, namely, to find three integers such that all FOUR of
the quantities ab+1, ac+1, bc+1, abc+1 are distinct squares, i.e., we
require integer solutions of the simultaneous equations

ab+1  = C^2
ac+1  = B^2
bc+1  = A^2
abc+1 = D^2

Obviously any such triple is a solution to the original problem of
Diophantus, but the 4th condition involving the product of all three
numbers significantly restricts the set of solutions.

Notice that we stipulated "distinct" squares, because some of the
infinitely many solutions of Diophantus's original problem have a=1,
and since bc+1 is a square they automatically satisfy abc+1=square
as well.  To avoid these trivial solutions we require all four of
the squares to be distinct.  (Equivalently, each of the numbers
a,b,c must be greater than 1.)

To characterize the solutions of this extended problem, it might
be useful to recall Saunderson's parameterization giving a large
class of solutions a,b,c of the original 3-square problem:

a = n      b = q(qn+2)     c = (q+1)[(q+1)n+2]

where n is an integer and q is any RATIONAL number such that b and
c are integers.  For example, with n=45 and q=2/5 we have

a=45     b=8     c=91

This example wan't chosen entirely at random, because it happens to
also be a solution of the extended problem, as shown by the fact
that
(45)(8)(91) + 1  =  181^2

However, not surprisingly, only a small fraction of the solutions
given by Saunderson's parameterization are also solutions of the
extended problem.  Notice that if we substitute Saunderson's
expressions for a,b,c into the equation abc+1 = D^2 we have a
quartic in q which happens to be fairly easy to solve explicitly,
giving the result
__________________________________
-(n+2) +- / n^2 + 4 +- 4 sqrt(n(n + D^2 - 1))
q  =  ---------------------------------------------
2n

Now, we need q to be rational, so the quantity under the radical must
be a square.  Thus we have an integer w such that

w^2  =  n^2 + 4 +- sqrt(n(n + D^2 - 1))

and this requires that the quantity in the square root must be a
square, so we have an integer m such that

m^2 = n^2 + n(D^2 - 1)

Solving this for n leads us to conclude that (D^2-1)^2 plus 4m^2
must be a square, so we have a Pythagorean triple

(D^2 - 1)^2  +  (2m)^2  =  R^2

for some integer R.  Obviously this implies the existence of an
integer k and mutually coprime integers x,y (one odd, one even)
such that

D^2 - 1 = 2kxy     2m = k(x^2 - y^2)   R = k(x^2 + y^2)

or possibly swapping the first two expressions depending on whether
2m/k is odd or even.  Here's a little table summarizing the smallest
solutions of the full 4-square problem

a    b    c      D      k     x     y
---  ---  ---  -----  ----- ----- -----
5    7   24     29     10     7     6
45    8   91    181     90    14    13
84   20  186    559    168    31    30
102   44  280   1121    204    56    55
105    8  171    379    210    19    18
119   40  297   1189    238    55    54
133    3  176    265    266    12    11
105   11  184    461    210    23    22
301   24  495   1891    602    55    54

Several regularities are apparent in this table, e.g., the value
of k is always equal to 2a, and we can verify that m always equals
a(x+y), which is obvious because x-y = 1 in all cases.

If we take advantage of these regularities, the problem reduces to
finding integers n and x such that

D^2  =  4nx(x-1) + 1
(1)
w^2  =  n^2 + 4 +- 4n(2x-1)

Given such integers, the value of Saunderson's q is then

n + 2 +- w
q = - ----------
2n

from which we can compute the values of the triple a,b,c.  Here is
a table of all the solutions given by this form for n and x less
than 10000:

n     x       a     b     c        A     B     C       D
----  ----    ----- ----- -----    ----- ----- -----  -------
5     7        5     7    24       13    11     6       29
45    14        8    45    91       64    27    19      181
3    77        3   133   176      153    23    20      265
105    19        8   105   171      134    37    29      379
11    70       11   105   184      139    45    34      461
20    63       20    84   186      125    61    41      559
44    85       44   102   280      169   111    67     1121
119    55       40   119   297      188   109    69     1189
301    55       24   301   495      386   109    85     1891
477    66       24   477   715      584   131   107     2861
85   456       85   672  1235      911   324   239     8399
114   561      114   816  1540     1121   419   305    11969
165   498      165   664  1491      995   496   331    12781
132   575      132   820  1610     1149   461   329    13201
280   469      280   546  1608      937   671   391    15679
2387   175       40  2387  3045     2696   349   309    17051
74  2065       74  3612  4720     4129   591   517    35519
85  6432       85 11859 13952    12863  1089  1004   118591
120  9880      120 18278 21360    19759  1601  1481   216449
3193  4182     3193  4551 15368     8363  7005  3812   472565
5705  7258     5705  7831 26904    14515 12389  6684  1096339

An exhaustive search of all integer triples a,b,c satisfying all
four conditions doesn't seem to turn up any additional solutions
(in this range) beyond those listed here, so it's possible that
(1) represents the necessary and sufficient conditions.

Of course, there are many symmetries here, beyond what I've explicitly
used, and I've just listed the first (n,x) yielding each solution
triple, but there are always at least three such pairs that give
the same triple (corresponding to the fact that we can identify the
parameter n with a, b, or c).

One striking feature of the table is how, when arranged by increasing
D, the values of n occur in "sawtooth" cycles, with the following
values
5   45
3  105
11   20   44  119  301  477
85  114  165  132  280 2387
74   85  120 3193 5705 ...

I suppose this might just be an artifact of that way I've selected
representative solutions and arranged them, but it seems to suggest
some underlying pattern that hasn't been brought out explicitly.

By the way, this problem also relates to the subject of representing
numbers as products of "shy squares" in multiple ways.  (A "shy square
is one less than a square).  Solutions to the general problem above
obviously represent integers that can be factored in two distinct
ways into shy squares, namely

(A^2 - 1)(B^2 - 1)(C^2 - 1)  =   (D^2 - 1)^2

In other words, this is a product of three distinct shy squares that
is also the square of a shy square.  There are several open questions
in this area.  For example, it's possible for a number to be the
product of two shy squares in 5 distinct ways, but it's not known
if there exists a six-way expressible number.
```