Magic squares and matrices

linear algebralinear-transformationsmagic squarematrices

A $3 × 3$ magic square with entries in $\mathbb{R}$ is a $3 × 3$ matrix $A = (a_{ij} )$ $\in$ $\mathbb{R}^{3× 3}$such that the sums of the numbers in each row, each column, and both main
diagonals are the same. That common sum is called the magic sum of the
magic square. Denote by MQ the set of $3 × 3$ magic squares, and for $a ∈ \mathbb{R}$,
denote by $MQ_a \subset MQ$, the subset of those magic squares with magic sum
a.

How do I find the magic square in $MQ_3$ and also the general formula for $MQ_a$?

Any help is much appreciated.

Best Answer

Start by considering the constraints of the magic square. I denote the sum by $s$ rather than $a$ to avoid confusion. The sum of diagonals is $$ a_{11}+a_{13}+a_{31}+a_{33}+2 a_{22}=2 s$$ The sum of the first and last row minus the second column is $$ (a_{11}+a_{12}+a_{13})+(a_{31}+a_{32}+a_{33})-(a_{12}+a_{22}+a_{32})=a_{11}+a_{13}+a_{31}+a_{33}-a_{22} =s$$ From these equations you get $a_{22}= s/3$, in your case $a_{22}=1$.

Fix now two entries that are not on the same diagonal, let say $a_{11}$ and $a_{13}$. Given the constraints, all other entries are now fixed.

EDIT

We have $a_{22}=s/3$ and we fix $a_{11}=b$, $a_{13}=b'$ ($b$ and $b'$ are names that i give to recall that these entries are fixed).

The entry $a_{33}$ is fixed due to the constraint on the diagonal $$a_{11}+ a_{22}+a_{33}= s\Rightarrow a_{33} = s-\frac s3-b=\frac{2s}{3}-b$$ Similarly, $a_{31}=\frac{2s}{3}-b'$

We now have all the corner entries. This fixes all the other entries. For example, $$a_{12}=s-a_{11}-a_{13}=s-b-b'$$ Similarly, $$a_{21}=\frac{s}{3}-b+b', \quad a_{23}=\frac{s}{3}+b-b',\quad a_{32}=b+b'-\frac{s}{3}$$

(I let you verify that all the constraints are indeed verified.)

Related Question