Complete solution for 4x4 semi-bimagic squares with one magic or bimagic diagonal
by Lee Morgenstern, August-September 2011.


Complete solution for rational 4x4 semi-bimagic squares with one magic diagonal.

Choose rational t and x. Compute w from either equation [1] or [2].

                 t^2 - 1
[1]  w  =  ----------------------
           2(t^2 - 2tx + x^2 - x)

                     (t^2 - 1)(x^2 + x - 1)
[2]  w  =  -------------------------------------------------
           2((t^2)(x^2) + 2tx^3 + x^4 - xt^2 - 2x^2 - x + 1)

      - t^2 - 2t + 2x^2 + 2x + 1
Z  =  ---------------------------
               t^2 - 1

      wZ^2 + Zwx + 3Zw - Z - wx + 2w + 3x - 2
D  =  ---------------------------------------
                 Z(Zw + 3w - 1)

J = (D - 1)(Z + 1)
M = 1 + x/(Zw)
G = x + x/(Zw)
H = M - 1 - (M - 1) / (G - M + 1)
C = J + (D - 1) / (D - J - 1)
L = C + (M - 1)(G - J) / [(C - J)(G - M + 1) + M - 1]
Q = G - D + 1 + [(D - 1)(D - G) - J(J - M)] / (D - G - J + M - 1)
B = - C + H + L + Q
E = D - G + L + Q - 1
I = G + H - M + 1
K = D - G - J + M + Q - 1
N = C + D - J - 1
P = - C + H + J + L - M + 1
F = 1
A = 0

A B C D
E F G H
I J K L
M N P Q

D,G,J,M will be a magic diagonal.

Example using equation [1] for w.

t = 6, x = -5  --> w = 5/36, Z = -1/5

   0  351  -99 -129

-269    1  175  216

 211 -104 -209  225

 181 -125  256 -189


Complete formulation for all rational 4x4 semi-bimagic squares with one bimagic diagonal,
which can then be translated to a 4x4 nearly bimagic square with 19/20 correct sums.

Finding a rational solution to either of equations [3] or [4] below generates a 19/20 bimagic square solution.
Finding all rational solutions to both equations [3] and [4] generates all 19/20 bimagic square solutions.

Solve equation [3] for rational u and x.

[3]  (x^4)(u-1)(u-1)(u-2)(u-2)
   + (x^3)(u)(u-1)(u-2)(u-2)
   + (x^2)(u^4 - 5u^3 + 12u^2 - 14u + 7)
   + (x)(u)(-2u^2 + 5u - 5)
   + u^2 - u + 1 = 0

Set t = ux.
Compute w using equation [1] above.
Compute Z, D, etc as above.
--------------
Two rational solutions to equation [3] are
(x,u) = (1,1)
(x,u) = (1,2)
but they both lead to magic squares with duplicate entries.
--------------

Solve equation [4] for rational t and x.

[4] (t^4)(x^2)(x^4 - 3x^3 + 4x^2 - 3x + 1)
  + (t^3)(x)(6x^6 - 9x^5 + 3x^4 - x^3 + x^2 + x - 1)
  + (t^2)(13x^8 - 2x^7 - 9x^6 - 5x^5 + 2x^4 + 5x^3 + x^2 - 3x + 1)
  + (t)(12x^9 + 12x^8 - 6x^7 - 17x^6 - 9x^5 + 9x^4 + 13x^3 - 5x^2 - 5x + 2)
  + 4x^10 + 8x^9 + 3x^8 - 6x^7 - 10x^6 - 6x^5 + 6x^4 + 8x^3 - 2x^2 - 3x + 1 = 0

Compute w using equation [2] above.
Compute Z, D, etc as above.
--------------
Two rational solutions to equation [4] are
(x,t) = (0,-1)
(x,t) = (1,-1)
but they both lead to magic squares with duplicate entries.


Are there any other rational solutions to equations [3] and [4]?
I can't find any. I graphed both equations [3] and [4] using a surface plot, height = f(t,x).
Places where height = 0 would be solutions.
Places where height = 0 and t and x are both rational would be rational solutions.
But for both equations, the entire surface (except for two points) appear to be above the height = 0 plane.
So, visually, there aren't any other rational (or real) solutions.


An idea for a rigorous proof is to try and exploit the height >= 0 feature.
If equations [3] and [4] could be expressed as the sum of two or more squared expressions, that would do it.

The sum of squares must be non-negative.  That would explain the height >= 0 feature.  Also, to be 0, each expression must be 0. So you would have at least two simultaneous equations in two unknowns.
That would mean there are a finite number of solutions and the rational ones could be easily enumerated.


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