\documentclass[a4paper,12pt]{article}

\begin{document}

\parindent=0pt


QUESTION

\setlength{\unitlength}{0.25in}
\begin{picture}(16,6)
\put(1,1){\framebox(1,1){4}} \put(2,1){\framebox(1,1){3}}
\put(3,1){\framebox(1,1){8}} \put(1,2){\framebox(1,1){9}}
\put(2,2){\framebox(1,1){5}} \put(3,2){\framebox(1,1){1}}
\put(1,3){\framebox(1,1){2}} \put(2,3){\framebox(1,1){7}}
\put(3,3){\framebox(1,1){6}}

\put(6,2){Figure 1} \put(6,1){$(n=3)$}

\put(10,1){\framebox(1,1){ }} \put(11,1){\framebox(1,1){ }}
\put(12,1){\framebox(1,1){ }} \put(13,1){\framebox(1,1){ }}
\put(10,2){\framebox(1,1){i}} \put(11,2){\framebox(1,1){ }}
\put(12,2){\framebox(1,1){ }} \put(13,2){\framebox(1,1){ }}
\put(10,3){\framebox(1,1){0}} \put(11,3){\framebox(1,1){0}}
\put(12,3){\framebox(1,1){g}} \put(13,3){\framebox(1,1){ }}
\put(10,4){\framebox(1,1){0}} \put(11,4){\framebox(1,1){0}}
\put(12,4){\framebox(1,1){c}} \put(13,4){\framebox(1,1){d}}

\put(16,2){figure 2} \put(16,1){$(n=4)$}
\end{picture}

A magic square is an $n\times n$ matrix containing the numbers
$1,2,\ldots n^2$ with the property that the sum of the entries
along each row, each column and each of the two main diagonals is
the same. (See figure 1 for an example with $n=3$.) The idea can
be generalised to squares containing any $n^2$ numbers (not
necessarily distinct). Show that there is a unique way to fill in
the remaining squares in figure 2 to make it into a magic square.

\bigskip

ANSWER

From the first row the magic constant is $c+d$. This can be used
to find the following entries:
$(M)_{24},(M)_{41},(M)_{32},(M)_{42}$ to give a square of the form

$$\left[\begin{array}{cccc}0&0&c&d\\0&0&g&c+d-g\\i&i-g-d&w&x
\\c+d-i&c+2d+g-i&y&z\end{array}\right]$$

The magic condition on rows three and four, columns three and four
and the main diagonal lead to five equations (which prove to be
consistent) in the four unknowns $w,x,y$ and $z$ and a sixth
equation can also be obtained from the fact that the sum of the
entries in the last two columns (or rows) is twice the magic
constant. Hence one has a choice of equations to solve for $w,x,y$
and $z$:

\begin{eqnarray}
w+x&=&c+2d+g-2i\\ w+y&=&d-g\\ w+z&=&c+d\\ x+z&=&-d+g\\
y+z&=&-c-2d-g+2i\\ w+x+y+z&=&0
\end{eqnarray}

[This system has a unique solution for $w,x,y$ and $z$ if and only
if precisely four of the equations are linearly independent. But

$(5)=-(1)+(2)+(4)$\ \ and\ \ $(6)=(2)+(4).$

Thus (5) and (6) are not needed to solve the equations, but the
four equations $(1),(2),(3),(4)$ are independent, so the system
does have a unique solution.]

 The solution is

$$\left[\begin{array}{cccc}0&0&c&d\\0&0&g&c+d-g\\i&i-g-d&c+2d-i&g-i
\\c+d-i&c+2d+g-i&-c-d-g+i&-d+i\end{array}\right]$$


\end{document}
