## Magic Square – Equal sums and square sums

$\begin{pmatrix} \;a \; & \; b \; & \; c \; \\ \;d \; & \; e \; & \; f \; \\ \;g \; & \; h \; & \; k \; \end{pmatrix}$

$det \; = \; a \, e \, k \; - \; a \, f \, h \; - \; b \, d \, k \; + \; b \, f \, g \; + \; c \, d \, h \; - \; c \, e \, g$

$\begin{pmatrix} \;4 \; & \; 3 \; & \; 8 \; \\ \;9 \; & \; 5 \; & \; 1 \; \\ \;2 \; & \; 7 \; & \; 6 \; \end{pmatrix}$           det = 360

$4^2 + 3^2 + 8^2 = 89$   ……….   $4^2 + 9^2 + 2^2 = 101$
$9^2 + 5^2 + 1^2 = 107$   ………   $3^2 + 5^2 + 7^2 = 83$
$2^2 + 7^2 + 6^2 = 89$   ……….   $8^2 + 1^2 + 6^2 = 101$

$4^2 + 5^2 + 6^2 = 77$   ……….   $8^2 + 5^2 + 2^2 = 93$
$2^2 + 3^2 + 1^2 = 14$   ……….   $1^2 + 7^2 + 4^2 = 66$
$9^2 + 7^2 + 8^2 = 194$   ………   $6^2 + 3^2 + 9^2 = 126$

$(4\times 9) + (3\times 5) + (8\times 1) = \; 59 \; = (9\times 2) + (5\times 7) + (1\times 6)$
$(4\times 3) + (9\times 5) + (2\times 7) = \; 71 \; = (3\times 8) + (5\times 1) + (7\times 6)$
$(4\times 5) + (9\times 7) + (2\times 3) = \; 89 \; = (5\times 6) + (7\times 8) + (3\times 1)$
$(8\times 5) + (1\times 7) + (6\times 3) = \; 65 \; = (5\times 2) + (7\times 4) + (3\times 9)$

Rows:

$(4 \, x^2 + 3 \, x + 8) \; + \; (9 \, x^2 + 5 \, x + 1) \; + \; (2 \, x^2 + 7 \, x + 6)$
$= \; (8 \, x^2 + 3 \, x + 4) \; + \; (x^2 + 5 \, x + 9) \; + \; (6 \, x^2 + 7 \, x + 2)$
$= \; 15 \, x^2 \; + \; 15 \, x \; + \; 15$

$(4 \, x^2 + 3 \, x + 8)^2 \; + \; (9 \, x^2 + 5 \, x + 1)^2 \; + \; (2 \, x^2 + 7 \, x + 6)^2$
$= \; (8 \, x^2 + 3 \, x + 4)^2 \; + \; (x^2 + 5 \, x + 9)^2 \; + \; (6 \, x^2 + 7 \, x + 2)^2$
$= \; 101 \, x^4 \; + \; 142 \, x^3 \; + \; 189 \, x^2 \; + \; 142 \, x \; + \; 101$

Columns :

$(4 \, x^2 + 9 \, x + 2) \; + \; (3 \, x^2 + 5 \, x + 7) \; + \; (8 \, x^2 + x + 6)$
$= \; (2 \, x^2 + 9 \, x + 4) \; + \; (7 \, x^2 + 5 \, x + 3) \; + \; (6 \, x^2 + x + 8)$
$= \; 15 \, x^2 \; + \; 15 \, x \; + \; 15$

$(4 \, x^2 + 9 \, x + 2)^2 \; + \; (3 \, x^2 + 5 \, x + 7)^2 \; + \; (8 \, x^2 + x + 6)^2$
$= \; (2 \, x^2 + 9 \, x + 4)^2 \; + \; (7 \, x^2 + 5 \, x + 3)^2 \; + \; (6 \, x^2 + x + 8)^2$
$= \; 89 \, x^4 \; + \; 118 \, x^3 \; + \; 261 \, x^2 \; + \; 118 \, x \; + \; 89$

and

{(4, 5, 6),   (2, 3, 1),   (9, 7, 8)}

$(4 \, x^2 + 5 \, x + 6) \; + \; (2 \, x^2 + 3 \, x + 1) \; + \; (9 \, x^2 + 7 \, x + 8)$
$= \; (6 \, x^2 + 5 \, x + 4) \; + \; (x^2 + 3 \, x + 2) \; + \; (8 \, x^2 + 7 \, x + 9)$
$= \; 15 \, x^2 \; + \; 15 \, x \; + \; 15$

$(4 \, x^2 + 5 \, x + 6)^2 \; + \; (2 \, x^2 + 3 \, x + 1)^2 \; + \; (9 \, x^2 + 7 \, x + 8)^2$
$= \; (6 \, x^2 + 5 \, x + 4)^2 \; + \; (x^2 + 3 \, x + 2)^2 \; + \; (8 \, x^2 + 7 \, x + 9)^2$
$= \; 101 \, x^4 \; + \; 178 \, x^3 \; + \; 279 \, x^2 \; + \; 178 \, x \; + \; 101$

{(8, 5, 2),   (1, 7, 4),   (6, 3, 9)}

$(8 \, x^2 + 5 \, x + 2) \; + \; (x^2 + 7 \, x + 4) \; + \; (6 \, x^2 + 3 \, x + 9)$
$= \; (2 \, x^2 + 5 \, x + 8) \; + \; (4 \, x^2 + 7 \, x + 1) \; + \; (9 \, x^2 + 3 \, x + 6)$
$= \; 15 \, x^2 \; + \; 15 \, x \; + \; 15$

$(8 \, x^2 + 5 \, x + 2)^2 \; + \; (x^2 + 7 \, x + 4)^2 \; + \; (6 \, x^2 + 3 \, x + 9)^2$
$= \; (2 \, x^2 + 5 \, x + 8)^2 \; + \; (4 \, x^2 + 7 \, x + 1)^2 \; + \; (9 \, x^2 + 3 \, x + 6)^2$
$= \; 101 \, x^4 \; + \; 130 \, x^3 \; + \; 231 \, x^2 \; + \; 130 \, x \; + \; 101$