## Encyclopedia > Magic square

Article Content

# Magic square

A magic square is an arrangement of numbers in a square grid, in such a way that the sum of the numbers in any row or column gives the same result.

Magic squares have a long history; the oldest known example dates back to 2800 B.C. (the 3×3 "Loh-Shu" magic square):

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

Another frequent requirement (satisfied by the above square) is that the only numbers used are 1,2,3,..., n2 for an n×n square. More sophisticated magic squares also produce the sum along the two diagonals; some 4x4 squares also give the sum in any small 2x2 block of four numbers.

The 4x4 magic square in Albrecht Dürer's engraving Melancholia I is believed to be the first seen in European art. The sum 34 can be found in the rows, columns, diagonals, any 2x2 block of numbers, the sum of the four corners, and the sum of the midddle two entries of the two outer columns and rows (eg 5 + 9 + 8 + 12). The two numbers in the middle of the bottom row give the date of the engraving: 1514.

$\begin{bmatrix}  16 & 3 & 2 & 13 \\ 5 & 10 & 11 & 8 \\ 9 & 6 & 7 & 12 \\ 4 & 15 & 14 & 1  \end{bmatrix}$

It has been known since 1693 that there exist 880 basic (excluding those obtained by rotation and reflection) 4x4 magic squares and 275305224 basic 5x5 magic squares. The number of basic magic squares of any higher degreee is not yet known but it was estimated by Klaus Pinn[?] and C. Wieczerkowski[?] (1998) using Monte Carlo simulation and methods from statistical mechanics to be (1.7745 ± 0.0016) × 1019 in the 6x6 case squares and (3.7982 ± 0.0004) × 1034 in the 7x7 case.

More formally, a magic square can be defined as an n-by-n matrix containing the numbers 1, 2,..., n2 such that the sum of any row, column or main diagonal yields the same result. All these sums are then necessarily equal to n × (n2 + 1) / 2.

Magic squares of odd order can be constructed by starting in the middle of the top row and going up and to the right, considering the edges joined, or if that is already occupied, going down, writing consecutively increasing numbers. The 5×5 square so constructed looks like this:

$\begin{bmatrix}  17 & 24 & 1 & 8 & 15 \\ 23 & 5 & 7 & 14 & 16 \\ 4 & 6 & 13 & 20 & 22 \\ 10 & 12 & 19 & 21 & 3 \\ 11 & 18 & 25 & 2 & 9  \end{bmatrix}$

All Wikipedia text is available under the terms of the GNU Free Documentation License

Search Encyclopedia
 Search over one million articles, find something about almost anything!

Featured Article
 Kingdom of Yugoslavia ... in Yugoslavia Military of Yugoslavia Foreign relations of Yugoslavia Republics within the Federal Republic of Yugoslavia Serbia and Montenegro the ...