Search method to find 4x4 magic squares of elements of a set
(i.e. 4x4 magic squares of cubes)
by Lee Morgenstern, January 2013.

Here is a method for finding 4x4 magic squares of elements of a set. The set must be a multiplicative domain so that the product of any two elements of the set is another element of the set. Examples of these sets are squares and cubes, but not primes.

The method uses a construction formula to fill in 12 of the 16 entries. Then it requires finding a solution of 4 equations for the last 4 entries. Each of the last 4 equations can be easily satisfied, but together they must form a particular pattern.

Given that A,B,C,... are elements of the set, find any solution to

   A + B  =  C + D  =  E + F.

For example, in the case of cubes, we can use any Taxicab(3) solution such as

   A = 167^3, B = 436^3,
   C = 228^3, D = 423^3,
   E = 255^3, F = 414^3.

Place the following 12 products into the magic square.

   CE  AD  BD  CF
    P  BF  AE   R
    Q  BE  AF   S
   DF  AC  BC  DE

6 of the 10 lines will have all four of its entries filled and will each have a magic sum of (A+B)^2.

For the cube example, we would have

   (228x255)^3  (167x423)^3  (436x423)^3  (228x414)^3
        P       (436x414)^3  (167x255)^3      R
        Q       (436x255)^3  (167x414)^3      S
   (423x414)^3  (167x228)^3  (436x228)^3  (423x255)^3

with a magic sum of (167^3 + 436^3)^2.

It remains to solve for P,Q,R,S to satisfy the remaining 4 lines. This requires

   P + Q = DE + CF
   P + R = BE + AF
   S + Q = AE + BF
   S + R = CE + DF

For the cube example, we require

   p^3 + q^3 = (423x255)^3 + (228x414)^3
   p^3 + r^3 = (436x255)^3 + (167x414)^3
   s^3 + q^3 = (167x255)^3 + (436x414)^3
   s^3 + r^3 = (228x255)^3 + (423x414)^3

We know that if a number is expressible as the sum of two cubes, then it is also expressible in an infinite number of ways as the sum of two rational cubes.  Each way corresponds to a rational point on an elliptic curve. Rational values for p,q,r,s are sufficient because we can scale everything by a common denominator to produce an integer solution. Each of the four equations is easily satisfiable by itself, but can the P,Q,R,S pattern be satisfied?

Here is a construction formula showing that the pattern is indeed possible for elements of a multiplicative domain.

Given that

   G + H  =  I + J
   M + N  =  U + V

we can construct

   GN + HN = IN + JN
   GN + GM = GU + GV
   HM + HN = HU + HV
   HM + GM = IM + JM

so that

   P = GN, Q = HN, R = GM, S = HM.

Note:  In the first step, if you choose a different assignment for E and F, you will get different values to satisfy the P,Q,R,S requirement.

Return to the home page