## Automedian Triangles and Magic Squares

```Given any triangle with sides of lengths 2A, 2B, 2C, the lengths
of the medians to the midpoints of those sides, respectively, are

(M_A)^2 = - A^2 + 2B^2 + 2C^2

(M_B)^2 =  2A^2 -  B^2 + 2C^2

(M_C)^2 =  2A^2 + 2B^2 -  C^2

An "automedian triangle" is defined as one whose three medians
are proportional to the three sides.  Obviously the middle edge
(in terms of length) must map to the middle-sized median, whereas
the largest edge must map to the smallest median, and vice versa.
Thus we have three equations of the form

3C^2 = - A^2 + 2B^2 + 2C^2

3B^2 =  2A^2 -  B^2 + 2C^2                  (1)

3A^2 =  2A^2 + 2B^2 -  C^2

Each of these equations reduces to simply  A^2 + C^2 = 2B^2, so
any solution of this equation in integers gives an automedian
triangle with integer sides.

Of course, if we want a strictly real triangle we also have to
impose the requirement that all three lengths satisfy the triangle
inequality.  For example, the smallest integer solution of (1) is
{A,B,C} = {1,5,7}, which doesn't make a real triangle, but there
are infinitely many others, such as {7,13,17}, {17,25,31},
{31,41,49}, {23,37,47}, etc. that do give real automedian
triangles with integer sides.

Equations (1) have a very interesting "duality", which can be seen
if we allow the variables on the left side to be any three quantities
(not necessarily some permutation of A,B,C).  In other words, we
have the equations

3I^2 = - A^2 + 2B^2 + 2C^2

3H^2 =  2A^2 -  B^2 + 2C^2                   (2)

3G^2 =  2A^2 + 2B^2 -  C^2

If we solve these three linear equations for the squares of A,B,C
in terms of the squares of I,H,G we get

3A^2 = - I^2 + 2H^2 + 2G^2

3B^2 =  2I^2 -  H^2 + 2G^2                   (3)

3C^2 =  2I^2 + 2H^2 -  G^2

which is formally identical to (2).  Thus, the triples {A,B,C} and
{I,H,G} are duals of each other.  Now, if we restrict the variables
to integer values, it turns out that almost the only solutions of
(2) give {I,H,G} as some permutation of {A,B,C}, so they are
automedian triangles (with integer sides).

This raises the question of whether there exist pairs of *distinct*
triples of integers {A,B,C} and {I,H,G} satisfying equations (2)
and (3).  These would correspond to integer triangles whose medians
are proportional to *each others* sides.  One reason this is an
interesting question is that if no such pair of "amicable triangles"
exists, it follows that there does not exist a 3x3 magic square of
(distinct) square numbers, which is an open problem in number theory.

In case the connection isn't obvious, consider a 3x3 magic square
consisting of distinct squares

A^2   B^2   C^2

D^2   E^2   F^2

G^2   H^2   I^2

By assumption the sum of each row, column, and main diagonal is the
same, and it's easy to see that this sum must be 3E^2.  Therefore,
we immediately have the following necessary conditions

A^2 + I^2  =  2E^2
B^2 + H^2  =  2E^2                      (4)
C^2 + G^2  =  2E^2
A^2 + B^2 + C^2 = 3E^2

Subtracting twice the 4th equation from three times each of the
previous three equations immediately gives equations (2).  Obviously
if {I,H,G} is a permutation of {A,B,C} the entries of the magic
square are not distinct, so all the "self-dual" solutions can be
ruled out, leaving us only with the question of whether there exist
any "amicable" solutions in all distinct numbers.

It turns that "amicable" solutions exist, but they aren't very
common.  The first several primitive solutions are

A      B      C       I      H      G       E^2       factorization of E^2
----   ----   ----    ----   ----   ----   ----------  -----------------------
49    421    541     559    371    149       157441  (29)(61)(89)
191    763    785     887    491    455       411625  (5^3)(37)(89)
361    941   1159    1201    829    479       786361  (37)(53)(401)
137   1123   1523    1543   1067    283      1199809  (13)(17)(61)(89)
931   1541   1691    1789   1301   1099      2033641  (41)(193)(257)
487   3647   4783    4903   3313   1183     12138289  (17^2)(97)(433)
53   4597   6223    6317   4333   1087     19953649  (61)(109)(3001)
5323   9005  10489   10861   8075   6023     73147825  (5^2)(73)(149)(269)
2447  11777  15487   15823  10847   4063    128177569  (13)(17^2)(109)(313)
10271  14939  16331   17071  13181  11411    198456241  (61)(1409)(2309)
8837  15467  16783   17923  12653  10847    199663249  (17)(73)(349)(461)
11215  16387  17041   18185  13709  12887    228235225  (5^2)(53)(281)(613)
6419  19283  19585   22133  12619  12145    265536625  (5^2)(53)(149)(269)
5071  20815  21997   24553  13975  12029    314282425  (5^2)(29)(41)(97)(109)
15953  23393  24553   26113  19727  18263    468193489  (89)(97)(193)(281)
3391  30085  30737   35063  18325  17209    620456425  (5^2)(53)(197)(2377)
7021  32653  39745   41803  27029  14735    898392625  (5^3)(13)(17^2)(1913)
2503  33827  41177   43487  27443  14207    948692089  (17)(149)(353)(1061)
11039  43727  51395   54727  34711  21805   1558452025  (5^2)(13)(29)(37)(41)(109)
17791  53675  61313   65737  41915  29641   2318936425  (5^2)(13)(17)(29)(41)(353)
34285  54173  61939   64205  48611  38227   2648871625  (5^3)(37)(41)(61)(229)
1523  53077  73693   74147  51797   8333   2750048569  (29)(37^2)(113)(613)
19177  56039  72755   74161  52223  23965   2933805625  (5^4)(1361)(3449)
9419  70651  74909   83899  46219  38941   3563879881  (17)(353)(401)(1481)
44405  61243  73751   73955  60749  44743   3720573025  (5^2)(13^2)(113)(7793)
22207  69395  77801   84151  52525  39007   3787270825  (5^2)(13)(149)(197)(397)
45653  68873  77593   80507  61823  50447   4282786729  (13)(29)(101)(137)(821)
17977  77635  84161   92911  54115  43273   4477813225  (5^2)(7561)(23689)
3001  67741  95041   95279  67069   7369   4543546921  (89)(173)(269)(1097)
42125  69283  86569   87205  67669  43417   4689613825  (5^2)(13)(41)(353)(997)
11659  80771  87871   97219  55349  43199   4793733121  (73)(113)(701)(829)
28729  72401  93881   95369  68401  33271   4960300801  (241)(2633)(7817)
41513  73195  90541   91991  69485  44587   5092836625  (5^3)(17)(61)(101)(389)
34391  77087  93395   96863  67991  42925   5282590825  (5^2)(37)(53)(277)(389)
27265  79717  94981  100015  66269  41533   5373190225  (5^2)(13^2)(521)(2441)
16885  84049 103343  108325  70393  36601   6009704425  (5^2)(17^3)(113)(433)
11095  83821 112447  114335  78547  23479   6597795625  (5^4)(17)(613)(1013)
20587 107309 110735  125341  67963  62225   8067095425  (5^2)(17^2)(41)(113)(241)
3167 107881 124295  134369  80167  51145   9032529025  (5^2)(13)(3181)(8737)
6889 110123 123635  135127  78611  54965   9153382225  (5^2)(13^2)(41)(53)(997)
30415 108683 128081  136025  87269  54983   9713936425  (5^2)(17)(29)(373)(2113)
82427 101483 111503  113533  96877  85153   9841976209  (13)(17^2)(37)(101)(701)
43409 107309 130151  135431  93331  57329  10112948521  (13)(37)(41)(193)(2657)
30395 119993 122599  138965  76399  72143  10117563625  (5^3)(13)(1933)(3221)
52303 116971 119125  132929  81997  78835  10202861425  (5^2)(73)(557)(10037)
57001 106171 133111  135071 101099  61439  10746644521  (29)(41)(101)(109)(821)
11095 119701 137407  148655  88843  57799  11110704025  (5^2)(17)(29)(53)(73)(233)
34577 132287 149177  161567  98993  71033  13649732209  (29)(73)(109)(149)(397)
34841 132685 171137  175663 120275  52759  16035692425  (5^2)(17^2)(1249)(1777)
7331 147239 171731  184651 111671  68251  17074867681  (73)(193)(509)(2381)
44375 164297 170621  191695 108271  98003  19358056825  (5^2)(17)(37)(157)(7841)
95851 157901 181969  188771 141029 108209  22410952321  (17)(53)(61)(173)(2357)
47905 196189 198623  226265 122477 118489  26745369625  (5^3)(13^2)(29)(149)(293)
49511 189449 224789  238321 152831  93371  29624119081  (109)(409)(557)(1193)
81121 200569 210541  232759 143281 128179  30378684361  (17)(41)(97)(613)(733)

(Some of these don't satisfy the triangle inequality, so they don't
give "real" geometrical triangles.)  Does this mean we have found
3x3 magic squares of squares?  No, because we eliminated the central
number E^2 from the magic square equations (4).  Nothing we've done
forces E^2 to be a square integer, and in fact E^2 is not a square
for any of the amicable pairs of triangles that I've found.

In fact, it's clear that E^2 must be the product of at least three
distinct primes of the form 4k+1, and in order for E^2 to be a square
it would be necessary for each of those primes to occur to an even
power.  It's possible that such cases don't exist, which is interesting
because equations (4) represent only a subset of the conditions that
would have to be met by a complete magic square of square integers.
For example, note that D^2 and F^2 don't even appear in those
equations, and we haven't imposed the sums on the outer columns.

So, since no one has ever been able to find a 3x3 magic square of
distinct square integers (nor prove that such is impossible), let
me propose the simpler(?) problem of finding a 3x3 magic square
of the following form

A^2    B^2    C^2

M     E^2     N

G^2    H^2    I^2

where M and N are integers but need not be squares.  Thus I'm only
requiring seven of the nine numbers to be squares, but they have to
be the seven noted above, not just any seven, because it's known
that there exists at least one magic square containing seven squares

23^2    205^2    289^2

373^2    425^2    222121

527^2    565^2    360721

but this doesn't satisfy the "amicable triangle" condition, i.e., it
doesn't have both outer rows (or both outer columns) filled with
squares, so it doesn't represent a solution of (4).

By the way, it's interesting that the "automedian" quality is really
just an expression of eigenvectors and eigenvalues.  In general,
suppose we have the linear system

a11 x1  +  a12 x2  +  a13 x3   =   y1

a21 x1  +  a22 x2  +  a23 x3   =   y2             (5)

a31 x1  +  a32 x2  +  a33 x3   =   y3

Now suppose we require the values of {y1,y2,y3} be proportional
to the values {x3,x2,x1}.  In other words, for some constant k we
have
y1  =  k x3
y2  =  k x2
y3  =  k x1

Inserting these into (5) gives

a11 x1  +  a12 x2  +  (a13-k) x3   =   0

a21 x1  +  (a22-k) x2  +  a23 x3   =   0             (6)

(a31-k) x1  +  a32 x2  +  a33 x3   =   0

Since the righthand vector is 0, the only non-trivial solutions
require a value of k for which the determinant of the coefficient
matrix is zero.  Obviously the determinant of this matrix is a cubic
in k, which has three roots, and those are called the eigenvalues
of the system.  By selecting any one of those eigenvalues, equations
(6) typically give a solution [x1,x2,x3], which is called an eigen
vector of the system.

Now, in the particular case of the automedian system we have
_          _   _     _     _        _
|  -1  2  2  | |  A^2  |   |  (Ma)^2  |
|            | |       |   |          |
|   2 -1  2  | |  B^2  | = |  (Mb)^2  |               (3)
|            | |       |   |          |
|_  2  2 -1 _| |_ C^2 _|   |_ (Mc)^2 _|

We want the medians to be proportional to the sides, so for some
constant k we have

(Ma)^2 = k C^2      (Mb)^2 = k B^2    (Mc)^2 = k A^2

(Note that we've chosen to permute the vector components in these
relations, but in general we could choose any permutation, including
identity.)  It follows that the value of k must be such that

|  -1    2   2-k |
|                |
Det|   2  -1-k   2  |  =  0
|                |
|  2-k   2   -1  |

Evaluating the determinant gives the "characteristic equation"

k^3 - 3k^2 - 9k + 27  =  0

which has the roots -3, 3, and 3.  With k=3 the system degenerates
to a single equation in three variables, A^2 + C^2 = 2B^2,
corresponding to the automedian triangles.  With k=-3 the system
degenerates to two conditions, A^2 = C^2 and B^2 + 2A^2 = 0.
Obviously the only real solution of the second condition is
A=B=0, but if we allow complex values we have the infinite family
of solutions A=q, C=+-q, B=sqrt(-2)q.

For more on the search for a magic square of squares, see the notes
Magic Square of Squares
Orthomagic Square of Squares
```