# magic square

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

Example:

$$\left(\begin{array}{ccc}\hfill 8\hfill & \hfill 1\hfill & \hfill 6\hfill \\ \hfill 3\hfill & \hfill 5\hfill & \hfill 7\hfill \\ \hfill 4\hfill & \hfill 9\hfill & \hfill 2\hfill \end{array}\right)$$ |

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,\mathrm{\dots},n$.

Title | magic square |
---|---|

Canonical name | MagicSquare |

Date of creation | 2013-03-22 12:14:39 |

Last modified on | 2013-03-22 12:14:39 |

Owner | drini (3) |

Last modified by | drini (3) |

Numerical id | 6 |

Author | drini (3) |

Entry type | Definition |

Classification | msc 05B15 |