Back

In recreational mathematics, a square array of numbers, usually positive integers, is called a **magic square** if the sums of the numbers in each row, each column, and both main diagonals are the same.^{[1]}^{[2]} The **order** of the magic square is the number of integers along one side (*n*), and the constant sum is called the **magic constant**. If the array includes just the positive integers , the magic square is said to be **normal**. Some authors take magic square to mean normal magic square.^{[3]}

Magic squares that include repeated entries do not fall under this definition and are referred to as **trivial**. Some well-known examples, including the Sagrada Família magic square and the Parker square are trivial in this sense. When all the rows and columns but not both diagonals sum to the magic constant we have **semimagic** squares (sometimes called **orthomagic** squares).

The mathematical study of magic squares typically deals with its construction, classification, and enumeration. Although completely general methods for producing all the magic squares of all orders do not exist, historically three general techniques have been discovered: by bordering method, by making composite magic squares, and by adding two preliminary squares. There are also more specific strategies like the continuous enumeration method that reproduces specific patterns. Magic squares are generally classified according to their order *n* as: odd if *n* is odd, evenly even (also referred to as "doubly even") if *n* is a multiple of 4, oddly even (also known as "singly even") if *n* is any other even number. This classification is based on different techniques required to construct odd, evenly even, and oddly even squares. Beside this, depending on further properties, magic squares are also classified as associative magic squares, pandiagonal magic squares, most-perfect magic squares, and so on. More challengingly, attempts have also been made to classify all the magic squares of a given order as transformations of a smaller set of squares. Except for *n* ≤ 5, the enumeration of higher order magic squares is still an open challenge. The enumeration of most-perfect magic squares of any order was only accomplished in the late 20th century.

Magic squares have a long history, dating back to at least 190 BCE in China. At various times they have acquired occult or mythical significance, and have appeared as symbols in works of art. In modern times they have been generalized a number of ways, including using extra or different constraints, multiplying instead of adding cells, using alternate shapes or more than two dimensions, and replacing numbers with shapes and addition with geometric operations.

**^**Miller, Jeff (September 3, 2016). "Earlier Known Uses of Some of the Words of Mathematics (M)".**^**Schwartzman, Steven (1994).*The Words of Mathematics: An Etymological Dictionary of Mathematical Terms Used in English*. MAA. p. 130.**^**Wolfram MathWorld: Magic Square Weisstein, Eric W.