What makes a square magic
A magic square is a square grid filled with different whole numbers, usually 1 up to the number of cells, arranged so that every row, every column and both long diagonals add to the same total. That total is called the magic constant. For a grid with n cells on a side, the constant is n times (n squared plus 1), divided by 2. With n equal to 3, that gives 15, and with n equal to 4 it gives 34.
The Lo Shu legend
In the Chinese legend, the flood-controlling hero Yu the Great saw a turtle emerge from the Luo river with markings on its shell: dots arranged in a three by three pattern. Read as numbers, the pattern is:
| 4 | 9 | 2 |
|---|---|---|
| 3 | 5 | 7 |
| 8 | 1 | 6 |
Every row, column and main diagonal adds to 15. For example, 4 plus 9 plus 2 is 15, and so is 2 plus 5 plus 8 along a diagonal. Up to rotation and reflection, this is the only way to arrange 1 to 9 in a three by three magic square, and the centre must be 5.
The legend is much later than the supposed events, and the early history of the diagram is murky. Ancient Chinese texts mention a river chart and a Luo writing as omens of kingship, but they do not describe the number grid in detail. Descriptions of a nine-palace arrangement associated with the numbers 1 to 9 appear in texts of the Han period and afterwards, and scholars debate how early the exact magic arrangement is attested. Treat the turtle as a story told about a real number pattern, not as a record.
Numbers and cosmology
In Chinese thought, the Lo Shu was connected to ideas about directions, the five phases and the arrangement of space, and the pattern later became tied to divination and to the layout of rooms and cities. Chinese number symbolism assigned odd numbers to yang and even to yin, and in the grid the odd numbers sit in the middle of the edges and the centre while the even numbers sit at the corners. The magic property itself was valued as a sign of order, not as something with practical use.
India and the Islamic world
Magic squares appear in other places, apparently from separate or partly linked traditions. In India, a four by four arrangement is described in the Brihat Samhita of Varahamihira, usually dated to the sixth century CE, in the context of preparing perfumes. Later Indian writers developed methods of building larger squares.
In the Islamic world, magic squares were studied by mathematicians from roughly the ninth and tenth centuries onward. Writers associated with the Brethren of Purity, in the tenth century, discussed squares of several sizes. Scholars also produced general methods of construction, and the squares were used in talismans and in astrological and devotional works, where particular grids were linked to planets, letters and prayers. A well-known example of this tradition is al-Buni, who died in 1225 and wrote on letters and squares. Some works from this tradition are attributed to Jabir ibn Hayyan, but the attribution is uncertain.
Whether the Islamic tradition borrowed from Chinese and Indian squares, or developed from Greek number theory, is a question historians still discuss. In the Byzantine world, the scholar Manuel Moschopoulos wrote a treatise on squares around 1300.
Europe: Agrippa and the planets
Magic squares reached western European readers in the late medieval and Renaissance periods, partly through astrological and magical texts. Heinrich Cornelius Agrippa’s De occulta philosophia, printed in 1531, associates squares of sizes 3 up to 9 with the seven planets known then: a three by three square with Saturn, a four by four with Jupiter, and so on up to nine by nine with the Moon. These were beliefs about symbolic correspondences, not claims that numbers affect the heavens or anyone’s life.
Durer’s square of 1514
The most famous magic square in art sits in the upper right of Albrecht Durer’s engraving Melencolia I, dated 1514. It reads:
| 16 | 3 | 2 | 13 |
|---|---|---|---|
| 5 | 10 | 11 | 8 |
| 9 | 6 | 7 | 12 |
| 4 | 15 | 14 | 1 |
Each row, column and long diagonal adds to 34. Check the first row: 16 plus 3 plus 2 plus 13 is 34. The four corners also add to 34, as do the four central cells and several other groupings. The two middle cells of the bottom row read 15 and 14, giving the year of the engraving.
Why Durer included the square is a matter of interpretation. One common reading connects it to the planet Jupiter, which in some traditions was thought to counter the melancholy of Saturn, but historians treat this as an interpretation of a puzzling image, not as a documented intention.
How many squares are there?
Magic squares of order four are far more numerous than those of order three. A famous count by the French mathematician Bernard Frenicle de Bessy, in the seventeenth century, found 880 essentially different four by four squares, not counting rotations and reflections. Durer’s is one of them. For larger orders the numbers become enormous and are known only through computation.
A pattern that outlived its legend
The magic square travelled from a legend about a river turtle to talismans, planetary tables and a Renaissance engraving. In each setting people read different meanings into it, and in the end the property that began it all, a grid in which the same total keeps appearing, is simply arithmetic. That is why it has lasted as a puzzle even as the symbolism around it changed.