# magic square

A magic square of order $n$ is an $n\times n$ array using each one of the numbers $1,2,3,\ldots,n^{2}$ once and such that the sum of the numbers in each row, column or main diagonal is the same.

Example:

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

It’s easy to prove that the sum is always $\frac{1}{2}n(n^{2}+1)$. So in the example with $n=3$ the sum is always $\frac{1}{2}(3\times 10)=15$.

One way to generalize this concept is to allow any numbers in the entries, instead of $1,2,\ldots,n$.

Title magic square MagicSquare 2013-03-22 12:14:39 2013-03-22 12:14:39 drini (3) drini (3) 6 drini (3) Definition msc 05B15