Complete formula of 3x3 semi-magic squares of squares
by Lee Morgenstern, April 2008.


This is for the 6-magic-line (or greater) 3x3 semi-magic square of squares.

If this is any 3x3 semi-magic square of squares
  A^2  B^2  C^2
  D^2  E^2  F^2
  G^2  H^2  I^2
then set
  r = (C - E) / (D - I)
  s = (G - E) / (B - I)
  u = (C - E) / (H - A)
  v = (G - E) / (F - A)
as the slopes of lines going through pairs of points on hyperbolas.

Then setting
  a = 2r/(1-r^2), b = (1+r^2)/(1-r^2)
  c = 2s/(1-s^2), d = (1+s^2)/(1-s^2)
  e = 2u/(1-u^2), f = (1+u^2)/(1-u^2)
  g = 2v/(1-v^2), h = (1+v^2)/(1-v^2)

we can describe the above semi-magic square as
  I = E [e(h-d) - g(f-b)] / (ag-ce)
  A = [E(f-b) + Ia] / e
  D = Ea - Ib
  C = Eb - Ia
  B = Ec - Id
  G = Ed - Ic
  H = Ee - Af
  F = Eg - Ah

Picking any rational values for r,s,u,v, and E and using the above formula always produces a semi-magic square of squares of rational numbers which can be scaled up to integers.

If the expressions for I and A are substituted into the rest, we can express all 9 entries from 4 terms r,s,u,v (and a...h).

  E = ag - ce
  I = bg - de - (fg - eh)
  A = ah - cf - (ad - bc)
  C = e(ad - bc) + a(fg - eh)
  G = g(ad - bc) + c(fg - eh)
  H = f(ad - bc) - a(fh - eg) + c
  F = h(ad - bc) + c(fh - eg) - a
  D = e(bd - ac) + b(fg - eh) - g
  B = g(ac - bd) + d(fg - eh) + e

will produce a rational scaling of every possible 3x3 semi-magic square of squares.

Example
  r = 6/7
  s = 1/2
  u = 6/5
  v = 3/2
produce the smallest 3x3 semi-magic square of squares
  32^2   4^2   47^2
  44^2  23^2   28^2
  17^2  52^2   16^2
with magic sum = 3249.


Return to the home page http://www.multimagie.com