thumb|The smallest (and unique [[up to rotation and reflection) non-trivial case of a magic square, order 3, magic sum 15]]
In mathematics, especially historical and recreational mathematics, a magic square is a square array of numbers, usually positive integers, where the sums of the numbers in each row, each column, and both main diagonals are the same. The order of a magic square is the number of integers along one side (n), and the constant sum is called the magic constant or magic sum. If the array includes just the positive integers <math>1,2,...,n^2</math>, the magic square is said to be normal. Many authors take magic square to mean normal magic square.
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 are trivial in this sense. When all the rows and columns but not both diagonals sum to the magic constant, this gives a semimagic square (sometimes called orthomagic square).
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, 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.
thumb|[[Melencolia I (Albrecht Dürer, 1514) includes an order 4 square with magic sum 34]]
thumb|alt=An order 4 magic square, detail from Albrecht Dürer's Melencolia I.|An order 4 magic square, detail from [[Melencolia I.]]
History
thumb|right|220px|Iron plate with an order-6 magic square in [[Eastern Arabic numerals from China, dating to the Yuan Dynasty (1271–1368).]]
The third-order magic square was known to Chinese mathematicians as early as 190 BCE, and explicitly given by the first century of the common era. The first dateable instance of the fourth-order magic square occurred in 587 CE in India. Specimens of magic squares of order 3 to 9 appear in an encyclopedia from Baghdad , the Encyclopedia of the Brethren of Purity (Rasa'il Ikhwan al-Safa). By the end of the 12th century, the general methods for constructing magic squares were well established. Around this time, some of these squares were increasingly used in conjunction with magic letters, as in Shams Al-ma'arif, for occult purposes. In India, all the fourth-order pandiagonal magic squares were enumerated by Narayana in 1356. Magic squares were made known to Europe through translation of Arabic sources as occult objects during the Renaissance, and the general theory had to be re-discovered independent of prior developments in China, India, and Middle East. Also notable are the ancient cultures with a tradition of mathematics and numerology that did not discover the magic squares: Greeks, Babylonians, Egyptians, and Pre-Columbian Americans.
Magic squares also appear in art. For example, a magic square appears in Albrecht Dürer's Melencolia (see the photograph of the work). Another one appears in Wilfredo Lam's Bélial, Emperor of the Flies, a magic square is seen in the lower left quadrant of the painting.
China
thumb|right|220px|A page displaying 9×9 magic square from Cheng Dawei's Suanfa tongzong (1593).
While ancient references to the pattern of even and odd numbers in the 3×3 magic square appear in the I Ching, the first unequivocal instance of this magic square appears in the chapter called Mingtang (Bright Hall) of a 1st-century book Da Dai Liji (Record of Rites by the Elder Dai), which purported to describe ancient Chinese rites of the Zhou dynasty.
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 4 || 9 || 2
|-
| 3 || 5 || 7
|-
| 8 || 1 || 6
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 2 || 16 || 13 || 3
|-
| 11 || 5 || 8 || 10
|-
| 7 || 9 || 12 || 6
|-
| 14 || 4 || 1 || 15
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 1 || 23 || 16 || 4 || 21
|-
| 15 || style="background-color: silver;"|14 || style="background-color: silver;"|7 || style="background-color: silver;"|18 || 11
|-
| 24 || style="background-color: silver;"|17 || style="background-color: silver;"|13 || style="background-color: silver;"|9 || 2
|-
| 20 || style="background-color: silver;"|8 || style="background-color: silver;"|19 || style="background-color: silver;"|12 || 6
|-
| 5 || 3 || 10 || 22 || 25
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| style="background-color: silver;"|13 || style="background-color: silver;"|22 || 18 || 27 || style="background-color: silver;"|11 || style="background-color: silver;"|20
|-
| style="background-color: silver;"|31 || style="background-color: silver;"|4 || 36 || 9 || style="background-color: silver;"|29 || style="background-color: silver;"|2
|-
| 12 || 21 || style="background-color: silver;"|14 || style="background-color: silver;"|23 || 16 || 25
|-
| 30 || 3 || style="background-color: silver;"|5 || style="background-color: silver;"|32 || 34 || 7
|-
| style="background-color: silver;"|17 || style="background-color: silver;"|26 || 10 || 19 || style="background-color: silver;"|15 || style="background-color: silver;"|24
|-
| style="background-color: silver;"|8 || style="background-color: silver;"|35 || 28 || 1 || style="background-color: silver;"|6 || style="background-color: silver;"|33
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| style="background-color: silver;"|46 || style="background-color: silver;"|8 || style="background-color: silver;"|16 || style="background-color: silver;"|20 || style="background-color: silver;"|29 || style="background-color: silver;"|7 || style="background-color: silver;"|49
|-
| style="background-color: silver;"|3 || 40 || 35 || 36 || 18 || 41 || style="background-color: silver;"|2
|-
| style="background-color: silver;"|44 || 12 || style="background-color: silver;"|33 || style="background-color: silver;"|23 || style="background-color: silver;"|19 || 38 || style="background-color: silver;"|6
|-
| style="background-color: silver;"|28 || 26 || style="background-color: silver;"|11 || style="background-color: silver;"|25 || style="background-color: silver;"|39 || 24 || style="background-color: silver;"|22
|-
| style="background-color: silver;"|5 || 37 || style="background-color: silver;"|31 || style="background-color: silver;"|27 || style="background-color: silver;"|17 || 13 || style="background-color: silver;"|45
|-
| style="background-color: silver;"|48 || 9 || 15 || 14 || 32 || 10 || style="background-color: silver;"|47
|-
| style="background-color: silver;"|1 || style="background-color: silver;"|43 || style="background-color: silver;"|34 || style="background-color: silver;"|30 || style="background-color: silver;"|21 || style="background-color: silver;"|42 || style="background-color: silver;"|4
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 61 || 3 || 2 || 64 || style="background-color: silver;"|57 || style="background-color: silver;"|7 || style="background-color: silver;"|6 || style="background-color: silver;"|60
|-
| 12 || 54 || 55 || 9 || style="background-color: silver;"|16 || style="background-color: silver;"|50 || style="background-color: silver;"|51 || style="background-color: silver;"|13
|-
| 20 || 46 || style="border-left:double; border-top:double;"|47 || style="border-top:double;"|17 || style="background-color: silver; border-top:double;"|24 || style="background-color: silver; border-top:double; border-right:double;"|42 || style="background-color: silver;"|43 || style="background-color: silver;"|21
|-
| 37 || 27 || style="border-left:double;"|26 || 40 || style="background-color: silver;"|33 || style="background-color: silver; border-right:double;"|31 || style="background-color: silver;"|30 || style="background-color: silver;"|36
|-
| style="background-color: silver;"|29 || style="background-color: silver;"|35 || style="background-color: silver; border-left:double;"|34 || style="background-color: silver;"|32 || 25 || style="border-right:double;"|39 || 38 || 28
|-
| style="background-color: silver;"|44 || style="background-color: silver;"|22 || style="background-color: silver; border-left:double; border-bottom:double;"|23 || style="background-color: silver; border-bottom:double;"|41 || style="border-bottom:double;"|48 || style="border-right:double; border-bottom:double;"|18 || 19 || 45
|-
| style="background-color: silver;"|52 || style="background-color: silver;"|14 || style="background-color: silver;"|15 || style="background-color: silver;"|49 || 56 || 10 || 11 || 53
|-
| style="background-color: silver;"|5 || style="background-color: silver;"|59 || style="background-color: silver;"|58 || style="background-color: silver;"|8 || 1 || 63 || 62 || 4
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| style="background-color: silver;"|31 || style="background-color: silver;"|76 || style="background-color: silver;"|13 || 36 || 81 || 18 || style="background-color: silver;"|29 || style="background-color: silver;"|74 || style="background-color: silver;"|11
|-
| style="background-color: silver;"|22 || style="background-color: silver;"|40 || style="background-color: silver;"|58 || 27 || 45 || 63 || style="background-color: silver;"|20 || style="background-color: silver;"|38 || style="background-color: silver;"|56
|-
| style="background-color: silver;"|67 || style="background-color: silver;"|4 || style="background-color: silver;"|49 || 72 || 9 || 54 || style="background-color: silver;"|65 || style="background-color: silver;"|2 || style="background-color: silver;"|47
|-
| 30 || 75 || 12 || style="background-color: silver;"|32 || style="background-color: silver;"|77 || style="background-color: silver;"|14 || 34 || 79 || 16
|-
| 21 || 39 || 57 || style="background-color: silver;"|23 || style="background-color: silver;"|41 || style="background-color: silver;"|59 || 25 || 43 || 61
|-
| 66 || 3 || 48 || style="background-color: silver;"|68 || style="background-color: silver;"|5 || style="background-color: silver;"|50 || 70 || 7 || 52
|-
| style="background-color: silver;"|35 || style="background-color: silver;"|80 || style="background-color: silver;"|17 || 28 || 73 || 10 || style="background-color: silver;"|33 || style="background-color: silver;"|78 || style="background-color: silver;"|15
|-
| style="background-color: silver;"|26 || style="background-color: silver;"|44 || style="background-color: silver;"|62 || 19 || 37 || 55 || style="background-color: silver;"|24 || style="background-color: silver;"|42 || style="background-color: silver;"|60
|-
| style="background-color: silver;"|71 || style="background-color: silver;"|8 || style="background-color: silver;"|53 || 64 || 1 || 46 || style="background-color: silver;"|69 || style="background-color: silver;"|6 || style="background-color: silver;"|51
|}
The above magic squares of orders 3 to 9 are taken from Yang Hui's treatise, in which the Luo Shu principle is clearly evident. The Japanese interest in magic squares began after the dissemination of Chinese works—Yang Hui's Suanfa and Cheng Dawei's Suanfa tongzong—in the 17th century, and as a result, almost all the wasans devoted their time to its study.
In the 1660 edition of Ketsugi-sho, Isomura Kittoku gave both odd and even ordered bordered magic squares as well as magic circles; while the 1684 edition of the same book contained a large section on magic squares, demonstrating that he had a general method for constructing bordered magic squares. In Jinko-ki (1665) by Muramatsu Kudayu Mosei, both magic squares and magic circles are displayed. The largest square Mosei constructs is of 19th order. Various magic squares and magic circles were also published by Nozawa Teicho in Dokai-sho (1666), Sato Seiko in Kongenki (1666), and Hosino Sanenobu in Ko-ko-gen Sho (1673). One of Seki Takakazu's Seven Books (Hojin Yensan) (1683) is devoted completely to magic squares and circles. This is the first Japanese book to give a general treatment of magic squares in which the algorithms for constructing odd, singly even and doubly even bordered magic squares are clearly described. In 1694 and 1695, Yueki Ando gave different methods to create the magic squares and displayed squares of order 3 to 30. A fourth-order magic cube was constructed by Yoshizane Tanaka (1651–1719) in Rakusho-kikan (1683). The study of magic squares was continued by Seki's pupils, notably by Katahiro Takebe, whose squares were displayed in the fourth volume of Ichigen Kappo by Shukei Irie, Yoshisuke Matsunaga in Hojin-Shin-jutsu, Yoshihiro Kurushima in Kyushi Iko who rediscovered a method to produce the odd squares given by Agrippa, and Naonobu Ajima. Thus by the beginning of the 18th century, the Japanese mathematicians were in possession of methods to construct magic squares of arbitrary order. After this, attempts at enumerating the magic squares was initiated by Nushizumi Yamaji.
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 2 || 3 || 5 || 8
|-
| 5 || 8 || 2 || 3
|-
| 4 || 1 || 7 || 6
|-
| 7 || 6 || 4 || 1
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 10 || 3 || 13 || 8
|-
| 5 || 16 || 2 || 11
|-
| 4 || 9 || 7 || 14
|-
| 15 || 6 || 12 || 1
|}
The square of Varahamihira as given above has sum of 18. Here the numbers 1 to 8 appear twice in the square. It is a pan-diagonal magic square. Four different magic squares can be obtained by adding 8 to one of the two sets of 1 to 8 sequence. The sequence is selected such that the number 8 is added exactly twice in each row, each column and each of the main diagonals. One of the possible magic squares shown in the right side. This magic square is remarkable in that it is a 90 degree rotation of a magic square that appears in the 13th century Islamic world as one of the most popular magic squares.
The construction of 4th-order magic square is detailed in a work titled Kaksaputa, composed by the alchemist Nagarjuna around 10th century CE. All of the squares given by Nagarjuna are 4×4 magic squares, and one of them is called Nagarjuniya after him. Nagarjuna gave a method of constructing 4×4 magic square using a primary skeleton square, given an odd or even magic sum. The Nagarjuniya square is given below, and has the sum total of 100.
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 30 || 16 || 18 || 36
|-
| 10 || 44 || 22 || 24
|-
| 32 || 14 || 20 || 34
|-
| 28 || 26 || 40 || 6
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 7 || 1 || 4 || 6
|-
| 2 || 8 || 5 || 3
|-
| 5 || 3 || 2 || 8
|-
| 4 || 6 || 7 || 1
|}
The Nagarjuniya square is a pan-diagonal magic square. It is made up of two arithmetic progressions starting from 6 and 16 with eight terms each, with a common difference between successive terms as 4. When these two progressions are reduced to the normal progression of 1 to 8, the adjacent square is obtained.
Around 12th-century, a 4×4 magic square was inscribed on the wall of Parshvanath temple in Khajuraho, India. Several Jain hymns teach how to make magic squares, although they are undateable. It is clear, however, that the study of magic squares was common in medieval Islam, and it was thought to have begun after the introduction of chess into the region. The first dateable appearance of a magic square of order 3 occurs in Jābir ibn Hayyān's (fl. c. 721 – c. 815) Kitab al-mawazin al-Saghir (The Small Book of Balances) where the magic square and its related numerology is associated with alchemy. These early treatises were purely mathematical, and the Arabic designation for magic squares used is wafq al-a'dad, which translates as harmonious disposition of the numbers. The squares of order 3 to 7 from Rasa'il are given below:
The magic square of order three was described as a child-bearing charm since its first literary appearances in the alchemical works of Jābir ibn Hayyān (fl. c. 721 – c. 815) and al-Ghazālī (1058–1111) and it was preserved in the tradition of the planetary tables. The earliest occurrence of the association of seven magic squares to the virtues of the seven heavenly bodies appear in Andalusian scholar Ibn Zarkali's (known as Azarquiel in Europe) (1029–1087) Kitāb tadbīrāt al-kawākib (Book on the Influences of the Planets). There are also references to the use of magic squares in astrological calculations, a practice that seems to have originated with the Arabs.
Latin Europe
thumb|215px|right|This page from [[Athanasius Kircher's Oedipus Aegyptiacus (1653) belongs to a treatise on magic squares and shows the Sigillum Iovis associated with Jupiter]]
Unlike in Persia and Arabia, better documentation exists of how the magic squares were transmitted to Europe. Around 1315, influenced by Arab sources, the Greek Byzantine scholar Manuel Moschopoulos wrote a mathematical treatise on the subject of magic squares, leaving out the mysticism of his Middle Eastern predecessors, where he gave two methods for odd squares and two methods for evenly even squares. Moschopoulos was essentially unknown to the Latin Europe until the late 17th century, when Philippe de la Hire rediscovered his treatise in the Royal Library of Paris. However, he was not the first European to have written on magic squares; and the magic squares were disseminated to rest of Europe through Spain and Italy as occult objects. The early occult treaties that displayed the squares did not describe how they were constructed. Thus the entire theory had to be rediscovered.
Magic squares had first appeared in Europe in Kitāb tadbīrāt al-kawākib (Book on the Influences of the Planets) written by Ibn Zarkali of Toledo, Al-Andalus, as planetary squares by 11th century. Ibn Zarkali's work was translated as Libro de Astromagia in the 1280s, due to Alfonso X of Castille. In the Alfonsine text, magic squares of different orders are assigned to the respective planets, as in the Islamic literature; unfortunately, of all the squares discussed, the Mars magic square of order five is the only square exhibited in the manuscript. It is interesting to observe that Paolo Dagomari, like Pacioli after him, refers to the squares as a useful basis for inventing mathematical questions and games, and does not mention any magical use. Incidentally, though, he also refers to them as being respectively the Sun's and the Moon's squares, and mentions that they enter astrological calculations that are not better specified. As said, the same point of view seems to motivate the fellow Florentine Luca Pacioli, who describes 3×3 to 9×9 squares in his work De Viribus Quantitatis by the end of 15th century.
Europe after 15th century
thumb|215px|right|A page from Simon de la Loubère's Du Royaume de Siam (1691) showcasing the Indian method of constructing an odd magic square.
The planetary squares had disseminated into northern Europe by the end of the 15th century. For instance, the Cracow manuscript of Picatrix from Poland displays magic squares of orders 3 to 9. The same set of squares as in the Cracow manuscript later appears in the writings of Paracelsus in Archidoxa Magica (1567), although in highly garbled form. In 1514 Albrecht Dürer immortalized a 4×4 square in his famous engraving Melencolia I. Paracelsus' contemporary Heinrich Cornelius Agrippa von Nettesheim published his famous three volume book De occulta philosophia in 1531, where he devoted Chapter 22 of Book II to the planetary squares shown below. An early account on the construction of bordered squares was given by Antoine Arnauld in his Nouveaux éléments de géométrie (1667). In the two treatise Des quarrez ou tables magiques and Table générale des quarrez magiques de quatre de côté, published posthumously in 1693, twenty years after his death, Bernard Frenicle de Bessy demonstrated that there were exactly 880 distinct magic squares of order four. Frenicle gave methods to construct magic square of any odd and even order, where the even ordered squares were constructed using borders. He also showed that interchanging rows and columns of a magic square produced new magic squares. By this time the earlier mysticism attached to the magic squares had completely vanished, and the subject was treated as a part of recreational mathematics.
In the 19th century, Bernard Violle gave a comprehensive treatment of magic squares in his three volume Traité complet des carrés magiques (1837–1838), which also described magic cubes, parallelograms, parallelopipeds, and circles. Pandiagonal squares were extensively studied by Andrew Hollingworth Frost, who learned it while in the town of Nasik, India, (thus calling them Nasik squares) in a series of articles: On the knight's path (1877), On the General Properties of Nasik Squares (1878), On the General Properties of Nasik Cubes (1878), On the construction of Nasik Squares of any order (1896). He showed that it is impossible to have normal singly-even pandiagonal magic square. Frederick A.P. Barnard constructed inlaid magic squares and other three dimensional magic figures like magic spheres and magic cylinders in Theory of magic squares and of magic cubes (1888). According to the legend, there was at one time in ancient China a huge flood. While the great king Yu was trying to channel the water out to sea, a turtle emerged from it with a curious pattern on its shell: a 3×3 grid in which circular dots of numbers were arranged, such that the sum of the numbers in each row, column and diagonal was the same: 15. According to the legend, thereafter people were able to use this pattern in a certain way to control the river and protect themselves from floods. The Lo Shu Square, as the magic square on the turtle shell is called, is the unique normal magic square of order three in which 1 is at the bottom and 2 is in the upper right corner. Every normal magic square of order three is obtained from the Lo Shu by rotation or reflection.
Magic square in Parshavnath temple
thumb|right|upright|220px|Magic Square at the [[Parshvanatha temple, Khajuraho|Parshvanatha temple, in Khajuraho, India]]
There is a well-known 12th-century 4×4 normal magic square inscribed on the wall of the Parshvanath temple in Khajuraho, India.
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 7 || 12 || 1 ||14
|-
| 2 || 13 || 8 || 11
|-
| 16 || 3 || 10 || 5
|-
| 9 || 6 || 15 || 4
|}
This is known as the Chautisa Yantra (Chautisa, 34; Yantra, lit. "device"), since its magic sum is 34. It is one of the three 4×4 pandiagonal magic squares and is also an instance of the most-perfect magic square. The study of this square led to the appreciation of pandiagonal squares by European mathematicians in the late 19th century. Pandiagonal squares were referred to as Nasik squares or Jain squares in older English literature.
Albrecht Dürer's magic square
thumb|Detail of Melencolia I
The order four normal magic square Albrecht Dürer immortalized in his 1514 engraving Melencolia I, referred to above, is believed to be the first seen in European art. The square associated with Jupiter appears as a talisman used to drive away melancholy. It is very similar to Yang Hui's square, which was created in China about 250 years before Dürer's time. As with every order 4 normal magic square, the magic sum is 34. But in the Durer square this sum is also found
in each of the quadrants, in the center four squares, and in the corner squares (of the 4×4 as well as the four contained 3×3 grids). This sum can also be found in the four outer numbers clockwise from the corners (3+8+14+9) and likewise the four counter-clockwise (the locations of four queens in the two solutions of the 4 queens puzzle), the two sets of four symmetrical numbers (2+8+9+15 and 3+5+12+14), the sum of the middle two entries of the two outer columns and rows (5+9+8+12 and 3+2+15+14), and in four kite or cross shaped quartets (3+5+11+15, 2+10+8+14, 3+9+7+15, and 2+6+12+14). The two numbers in the middle of the bottom row give the date of the engraving: 1514. The numbers 1 and 4 at either side of the date correspond respectively to the letters "A" and "D", the initials of the artist.
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 16 || 3 || 2 || 13
|-
| 5 || 10 || 11 || 8
|-
| 9 || 6 || 7 || 12
|-
| 4 || 15 || 14 || 1
|}
Dürer's magic square can also be extended to a magic cube.
Sagrada Família magic square
right|thumb|220px|A magic square on the Sagrada Família church façade
The Passion façade of the Sagrada Família church in Barcelona, conceptualized by Antoni Gaudí and designed by sculptor Josep Subirachs, features a trivial order 4 magic square: The magic constant of the square is 33, the age of Jesus at the time of the Passion. Structurally, it is very similar to the Melancholia magic square, but it has had the numbers in four of the cells reduced by 1.
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 1 || 14 || 14 || 4
|-
| 11 || 7 || 6 || 9
|-
| 8 || 10 || 10 || 5
|-
| 13 || 2 || 3 || 15
|}
Trivial squares such as this one are not generally mathematically interesting and only have historical significance. Lee Sallows has pointed out that, due to Subirachs's ignorance of magic square theory, the renowned sculptor made a needless blunder, and supports this assertion by giving several examples of non-trivial 4×4 magic squares showing the desired magic constant of 33.
Similarly to Dürer's magic square, the Sagrada Familia's magic square can also be extended to a magic cube.
Properties of magic squares
Magic constant
The constant that is the sum of any row, or column, or diagonal is called the magic constant or magic sum, M. Every normal magic square has a constant dependent on the order , calculated by the formula <math>M = n(n^2 + 1)/2</math>. This can be demonstrated by noting that the sum of <math>1,2,...,n^2</math> is <math>n^2(n^2 + 1)/2</math>. Since the sum of each row is <math>M</math>, the sum of <math>n</math> rows is <math>n M = n^2(n^2 + 1)/2</math>, which when divided by the order yields the magic constant as <math>M = n(n^2 + 1)/2</math>. For normal magic squares of orders n = 3, 4, 5, 6, 7, and 8, the magic constants are, respectively: 15, 34, 65, 111, 175, and 260 (sequence A006003 in the OEIS).
Magic square of order 1 is trivial
The 1×1 magic square, with only one cell containing the number 1, is called trivial, because it is typically not under consideration when discussing magic squares; but it is indeed a magic square by definition, if a single cell is regarded as a square of order one.
Magic square of order 2 cannot be constructed
Normal magic squares of all sizes can be constructed except 2×2 (that is, where order n = 2).
Center of mass
If the numbers in the magic square are seen as masses located in various cells, then the center of mass of a magic square coincides with its geometric center.
Moment of inertia
The moment of inertia of a magic square has been defined as the sum over all cells of the number in the cell times the squared distance from the center of the cell to the center of the square; here the unit of measurement is the width of one cell. (Thus for example a corner cell of a 3×3 square has a distance of <math>\sqrt{2},</math> a non-corner edge cell has a distance of 1, and the center cell has a distance of 0.) Then all magic squares of a given order have the same moment of inertia as each other. For the order-3 case the moment of inertia is always 60, while for the order-4 case the moment of inertia is always 340. In general, for the n×n case the moment of inertia is <math>n^2(n^4-1)/12.</math> Clearly, this decomposition carries over to magic squares as well, since a magic square can be recovered from a doubly stochastic matrix by multiplying it by the magic constant.
Classification of magic squares
thumb|upright|[[Euler diagram of the properties of some types of 4×4 magic squares. Cells of the same colour sum to the magic constant.<br /><nowiki>*</nowiki> In 4×4 most-perfect magic squares, any 2 cells that are 2 cells diagonally apart (including wraparound) sum to half the magic constant, hence any 2 such pairs also sum to the magic constant.]]
While the classification of magic squares can be done in many ways, some useful categories are given below. An n×n square array of integers 1, 2, ..., n<sup>2</sup> is called:
- Semi-magic square when its rows and columns sum to give the magic constant.
- Simple magic square when its rows, columns, and two diagonals sum to give magic constant and no more. They are also known as ordinary magic squares or normal magic squares.
- Self-complementary magic square when it is a magic square which when complemented (i.e. each number subtracted from n<sup>2</sup> + 1) will give a rotated or reflected version of the original magic square.
- Associative magic square when it is a magic square with a further property that every number added to the number equidistant, in a straight line, from the center gives n<sup>2</sup> + 1. They are also called symmetric magic squares. Associative magic squares do not exist for squares of singly even order. All associative magic square are self-complementary magic squares as well.
- Pandiagonal magic square when it is a magic square with a further property that the broken diagonals sum to the magic constant. They are also called panmagic squares, perfect squares, diabolic squares, Jain squares, or Nasik squares. Panmagic squares do not exist for singly even orders. However, singly even non-normal squares can be panmagic.
- Ultra magic square when it is both associative and pandiagonal magic square. Ultra magic square exist only for orders n ≥ 5.
- Bordered magic square when it is a magic square and it remains magic when the rows and columns on the outer edge are removed. They are also called concentric bordered magic squares if removing a border of a square successively gives another smaller bordered magic square. Bordered magic square do not exist for order 4.
- Composite magic square when it is a magic square that is created by "multiplying" (in some sense) smaller magic squares, such that the order of the composite magic square is a multiple of the order of the smaller squares. Such squares can usually be partitioned into smaller non-overlapping magic sub-squares.
- Inlaid magic square when it is a magic square inside which a magic sub-square is embedded, regardless of construction technique. The embedded magic sub-squares are themselves referred to as inlays.
- Most-perfect magic square when it is a pandiagonal magic square with two further properties (i) each 2×2 subsquare add to 1/k of the magic constant where n = 4k, and (ii) all pairs of integers distant n/2 along any diagonal (major or broken) are complementary (i.e. they sum to n<sup>2</sup> + 1). The first property is referred to as compactness, while the second property is referred to as completeness. Most-perfect magic squares exist only for squares of doubly even order. All the pandiagonal squares of order 4 are also most perfect.
- Franklin magic square when it is a doubly even magic square with three further properties (i) every bent diagonal adds to the magic constant, (ii) every half row and half column starting at an outside edge adds to half the magic constant, and (iii) the square is compact.
- Multimagic square when it is a magic square that remains magic even if all its numbers are replaced by their k-th power for 1 ≤ k ≤ P. They are also known as P-multimagic square or satanic squares. They are also referred to as bimagic squares, trimagic squares, tetramagic squares, and pentamagic squares when the value of P is 2, 3, 4, and 5 respectively.
Enumeration of magic squares
;Low-order squares
There is only one (trivial) magic square of order 1 and no magic square of order 2. As mentioned above, the set of normal squares of order three constitutes a single equivalence class-all equivalent to the Lo Shu square. Thus there is basically just one normal magic square of order 3.
The number of different n × n magic squares for n from 1 to 6, not counting rotations and reflections is:
: 1, 0, 1, 880, 275305224, 17753889197660635632.
; Magic tori
Cross-referenced to the above sequence, a new classification enumerates the magic tori that display these magic squares. The number of magic tori of order n from 1 to 5, is:
: 1, 0, 1, 255, 251449712 .
; Higher-order squares and tori
thumb|right|Semi-log plot of Pn, the probability of magic squares of dimension n
The number of distinct normal magic squares rapidly increases for higher orders.
The 880 magic squares of order 4 are displayed on 255 magic tori of order 4 and the 275,305,224 squares of order 5 are displayed on 251,449,712 magic tori of order 5. The numbers of magic tori and distinct normal squares are not yet known for orders beyond 5 and 6, respectively.
Algorithms tend to only generate magic squares of a certain type or classification, making counting all possible magic squares quite difficult. Since traditional counting methods have proven unsuccessful, statistical analysis using the Monte Carlo method has been applied. The basic principle applied to magic squares is to randomly generate n × n matrices of elements 1 to n<sup>2</sup> and check if the result is a magic square. The probability that a randomly generated matrix of numbers is a magic square is then used to approximate the number of magic squares.
More intricate versions of the Monte Carlo method, such as the exchange Monte Carlo, and Monte Carlo backtracking have produced even more accurate estimations. Using these methods it has been shown that the probability of magic squares decreases rapidly as n increases. Using fitting functions give the curves seen to the right.
Transformations that preserve the magic property
For any magic square
- A magic square remains magic when its numbers are multiplied by any constant. In discussing magic squares, equivalent squares are usually not considered as distinct. The 8 equivalent squares are given for the 3×3 magic square below:
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 8 || 1 || 6
|-
| 3 || 5 || 7
|-
| 4 || 9 || 2
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 6 || 1 || 8
|-
| 7 || 5 || 3
|-
| 2 || 9 || 4
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 2 || 7 || 6
|-
| 9 || 5 || 1
|-
| 4 || 3 || 8
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 4 || 3 || 8
|-
| 9 || 5 || 1
|-
| 2 || 7 || 6
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 2 || 9 || 4
|-
| 7 || 5 || 3
|-
| 6 || 1 || 8
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 4 || 9 || 2
|-
| 3 || 5 || 7
|-
| 8 || 1 || 6
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 8 || 3 || 4
|-
| 1 || 5 || 9
|-
| 6 || 7 || 2
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 6 || 7 || 2
|-
| 1 || 5 || 9
|-
| 8 || 3 || 4
|}
- Given any magic square, another magic square of the same order can be formed by interchanging the row and the column which intersect in a cell on a diagonal with the row and the column which intersect in the complementary cell (i.e. cell symmetrically opposite from the center) of the same diagonal. For an even square, there are n/2 pairs of rows or columns that can be interchanged; thus equivalent magic squares by combining such interchanges can be obtained. For odd square, there are pairs of rows or columns that can be interchanged; and 2<sup>n−1</sup> equivalent magic squares obtained by combining such interchanges. Interchanging all the rows flips the square vertically (i.e. reflected along the horizontal axis), while interchanging all the columns flips the square horizontally (i.e. reflected along the vertical axis). In the example below, a 4×4 associative magic square on the left is transformed into a square on the right by interchanging the second and third row, yielding the famous Durer's magic square.
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 16 || 3 || 2 || 13
|-
| style="background-color: silver;"|9 || style="background-color: silver;"|6 || style="background-color: silver;"|7 || style="background-color: silver;"|12
|-
| style="background-color: silver;"|5 || style="background-color: silver;"|10 || style="background-color: silver;"|11 || style="background-color: silver;"|8
|-
| 4 || 15 || 14 || 1
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| 16 || 3 || 2 || 13
|-
| 5 || 10 || 11 || 8
|-
| 9 || 6 || 7 || 12
|-
| 4 || 15 || 14 || 1
|}
- An associative magic square remains associative when two same sided rows (or columns) are interchanged along with corresponding other sided rows (or columns).
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
| 96 || 11 || 89 || 68
|-
| 88 || 69 || 91 || 16
|-
| 61 || 86 || 18 || 99
|-
| 19 || 98 || 66 || 81
|}
When the extra constraint is to display some date, especially a birth date, then such magic squares are called birthday magic square. An early instance of such birthday magic square was created by Srinivasa Ramanujan. He created a 4×4 square in which he entered his date of birth in DD–MM–CC–YY format in the top row and the magic happened with additions and subtractions of numbers in squares. Not only do the rows, columns, and diagonals add up to the same number, but the four corners, the four middle squares (17, 9, 24, 89), the first and last rows two middle numbers (12, 18, 86, 23), and the first and last columns two middle numbers (88, 10, 25, 16) all add up to the sum of 139.
Multiplicative magic squares
Instead of adding the numbers in each row, column and diagonal, one can apply some other operation. For example, a multiplicative magic square has a constant product of numbers. A multiplicative magic square can be derived from an additive magic square by raising 2 (or any other integer) to the power of each element, because the logarithm of the product of 2 numbers is the sum of logarithm of each. Alternatively, if any 3 numbers in a line are 2<sup>a</sup>, 2<sup>b</sup> and 2<sup>c</sup>, their product is 2<sup>a+b+c</sup>, which is constant if a+b+c is constant, as they would be if a, b and c were taken from ordinary (additive) magic square. For example, the original Lo-Shu magic square becomes:
{| class="wikitable" style="margin:0.5em auto;text-align:center;table-layout:fixed;"
|-
|+ M = 32768
|-
| 16 || 512 || 4
|-
| 8 || 32 || 128
|-
| 256 || 2 || 64
|}
Other examples of multiplicative magic squares include:
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
|+ M = 216
|-
| 2 || 9 || 12
|-
| 36 || 6 || 1
|-
| 3 || 4 || 18
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
|+ M = 6720
|-
| 1 || 6 || 20 || 56
|-
| 40 || 28 || 2 || 3
|-
| 14 || 5 || 24 || 4
|-
| 12 || 8 || 7 || 10
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
|+ M = 6,227,020,800
|-
|27 ||50 ||66 ||84 ||13 ||2 ||32
|-
|24 ||52 ||3 ||40 ||54 ||70 ||11
|-
|56 ||9 ||20 ||44 ||36 ||65 ||6
|-
|55 ||72 ||91 ||1 ||16 ||36 ||30
|-
|4 ||24 ||45 ||60 ||77 ||12 ||26
|-
|10 ||22 ||48 ||39 ||5 ||48 ||63
|-
|78 ||7 ||8 ||18 ||40 ||33 ||60
|}
Multiplicative magic squares of complex numbers
Still using Ali Skalli's non iterative method, it is possible to produce an infinity of multiplicative magic squares of complex numbers belonging to <math>\mathbb C</math> set. On the example below, the real and imaginary parts are integer numbers, but they can also belong to the entire set of real numbers <math>\mathbb R</math>.
The product is: −352,507,340,640 − 400,599,719,520 i.
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:left;"
|+ Skalli multiplicative 7×7 of complex numbers
|-
| style="text-align:right;border-right:none;padding-right:0;width:5ex;"| 21 ||style="border-left:none;padding-left:0;width:6ex;"| +14i
| style="text-align:right;border-right:none;padding-right:0;width:5ex;"|−70 ||style="border-left:none;padding-left:0;width:6ex;"| +30i
| style="text-align:right;border-right:none;padding-right:0;width:5ex;"|−93 ||style="border-left:none;padding-left:0;width:6ex;"|−9i
| style="text-align:right;border-right:none;padding-right:0;width:5ex;"|−105||style="border-left:none;padding-left:0;width:6ex;"|−217i
| style="text-align:right;border-right:none;padding-right:0;width:5ex;"| 16 ||style="border-left:none;padding-left:0;width:6ex;"| +50i
| style="text-align:right;border-right:none;padding-right:0;width:5ex;"| 4 ||style="border-left:none;padding-left:0;width:6ex;"|−14i
| style="text-align:right;border-right:none;padding-right:0;width:5ex;"| 14 ||style="border-left:none;padding-left:0;width:6ex;"|−8i
|-
| style="text-align:right;border-right:none;padding-right:0;"| 63||style="border-left:none;padding-left:0;"|−35i
| style="text-align:right;border-right:none;padding-right:0;"| 28||style="border-left:none;padding-left:0;"|+114i
| style="text-align:right;border-right:none;padding-right:0;"| ||style="border-left:none;padding-left:0;"|−14i
| style="text-align:right;border-right:none;padding-right:0;"| 2||style="border-left:none;padding-left:0;"|+6i
| style="text-align:right;border-right:none;padding-right:0;"| 3||style="border-left:none;padding-left:0;"|−11i
| style="text-align:right;border-right:none;padding-right:0;"| 211||style="border-left:none;padding-left:0;"|+357i
| style="text-align:right;border-right:none;padding-right:0;"| −123||style="border-left:none;padding-left:0;"|−87i
|-
| style="text-align:right;border-right:none;padding-right:0;"| 31||style="border-left:none;padding-left:0;"|−15i
| style="text-align:right;border-right:none;padding-right:0;"| 13||style="border-left:none;padding-left:0;"|−13i
| style="text-align:right;border-right:none;padding-right:0;"| −103||style="border-left:none;padding-left:0;"|+69i
| style="text-align:right;border-right:none;padding-right:0;"| −261||style="border-left:none;padding-left:0;"|−213i
| style="text-align:right;border-right:none;padding-right:0;"| 49||style="border-left:none;padding-left:0;"|−49i
| style="text-align:right;border-right:none;padding-right:0;"| −46||style="border-left:none;padding-left:0;"|+2i
| style="text-align:right;border-right:none;padding-right:0;"| −6||style="border-left:none;padding-left:0;"|+2i
|-
| style="text-align:right;border-right:none;padding-right:0;"| 102||style="border-left:none;padding-left:0;"|−84i
| style="text-align:right;border-right:none;padding-right:0;"| −28||style="border-left:none;padding-left:0;"|−14i
| style="text-align:right;border-right:none;padding-right:0;"| 43||style="border-left:none;padding-left:0;"|+247i
| style="text-align:right;border-right:none;padding-right:0;"| −10||style="border-left:none;padding-left:0;"|−2i
| style="text-align:right;border-right:none;padding-right:0;"| 5||style="border-left:none;padding-left:0;"|+9i
| style="text-align:right;border-right:none;padding-right:0;"| 31||style="border-left:none;padding-left:0;"|−27i
| style="text-align:right;border-right:none;padding-right:0;"| −77||style="border-left:none;padding-left:0;"|+91i
|-
| style="text-align:right;border-right:none;padding-right:0;"| −22||style="border-left:none;padding-left:0;"|−6i
| style="text-align:right;border-right:none;padding-right:0;"| 7||style="border-left:none;padding-left:0;"|+7i
| style="text-align:right;border-right:none;padding-right:0;"| 8||style="border-left:none;padding-left:0;"|+14i
| style="text-align:right;border-right:none;padding-right:0;"| 50||style="border-left:none;padding-left:0;"|+20i
| style="text-align:right;border-right:none;padding-right:0;"| −525||style="border-left:none;padding-left:0;"|−492i
| style="text-align:right;border-right:none;padding-right:0;"| −28||style="border-left:none;padding-left:0;"|−42i
| style="text-align:right;border-right:none;padding-right:0;"| −73||style="border-left:none;padding-left:0;"|+17i
|-
| style="text-align:right;border-right:none;padding-right:0;"| 54||style="border-left:none;padding-left:0;"|+68i
| style="text-align:right;border-right:none;padding-right:0;"| 138||style="border-left:none;padding-left:0;"|−165i
| style="text-align:right;border-right:none;padding-right:0;"| −56||style="border-left:none;padding-left:0;"|−98i
| style="text-align:right;border-right:none;padding-right:0;"| −63||style="border-left:none;padding-left:0;"|+35i
| style="text-align:right;border-right:none;padding-right:0;"| 4||style="border-left:none;padding-left:0;"|−8i
| style="text-align:right;border-right:none;padding-right:0;"| 2||style="border-left:none;padding-left:0;"|−4i
| style="text-align:right;border-right:none;padding-right:0;"| 70||style="border-left:none;padding-left:0;"|−53i
|-
| style="text-align:right;border-right:none;padding-right:0;"| 24||style="border-left:none;padding-left:0;"|+22i
| style="text-align:right;border-right:none;padding-right:0;"| −46||style="border-left:none;padding-left:0;"|−16i
| style="text-align:right;border-right:none;padding-right:0;"| 6||style="border-left:none;padding-left:0;"|−4i
| style="text-align:right;border-right:none;padding-right:0;"| 17||style="border-left:none;padding-left:0;"|+20i
| style="text-align:right;border-right:none;padding-right:0;"| 110||style="border-left:none;padding-left:0;"|+160i
| style="text-align:right;border-right:none;padding-right:0;"| 84||style="border-left:none;padding-left:0;"|−189i
| style="text-align:right;border-right:none;padding-right:0;"| 42||style="border-left:none;padding-left:0;"|−14i
|}
Additive-multiplicative magic and semimagic squares
Additive-multiplicative magic squares and semimagic squares satisfy properties of both ordinary and multiplicative magic squares and semimagic squares, respectively.
{| width="100%"
| valign="top"|
{| class="wikitable" style="text-align:center;"
|+
First known<br/>additive-multiplicative magic square<br />
|-
| 162 || 207 || 51 || 26 || 133 || 120 || 116 || 25
|-
| 105 || 152 || 100 || 29 || 138 || 243 || 39 || 34
|-
| 92 || 27 || 91 || 136 || 45 || 38 || 150 || 261
|-
| 57 || 30 || 174 || 225 || 108 || 23 || 119 || 104
|-
| 58 || 75 || 171 || 90 || 17 || 52 || 216 || 161
|-
| 13 || 68 || 184 || 189 || 50 || 87 || 135 || 114
|-
| 200 || 203 || 15 || 76 || 117 || 102 || 46 || 81
|-
| 153 || 78 || 54 || 69 || 232 || 175 || 19 || 60
|}
| valign="top"|
{| class="wikitable" style="text-align:center;"
|+
Smallest known additive-multiplicative semimagic square<br />
|-
| 156 || 18 || 48 || 25
|-
| 30 || 144 || 60 || 13
|-
| 16 || 20 || 130 || 81
|-
| 45 || 65 || 9 || 128
|}
|}
It is unknown if any additive-multiplicative magic squares smaller than 7×7 exist, but it has been proven that no 3×3 or 4×4 additive-multiplicative magic squares and no 3×3 additive-multiplicative semimagic squares exist.
{| class="wikitable" style="text-align:center;"
|+
Smallest known additive-multiplicative magic square<br />
|-
|126
|66
|50
|90
|48
|1
|84
|-
|20
|70
|16
|54
|189
|110
|6
|-
|100
|2
|22
|98
|36
|72
|135
|-
|96
|60
|81
|4
|10
|49
|165
|-
|3
|63
|30
|176
|120
|45
|28
|-
|99
|180
|14
|25
|7
|108
|32
|-
|21
|24
|252
|18
|55
|80
|15
|}
Geometric magic squares
thumb|right| text-bottom |160px|A geometric magic square.
Magic squares may be constructed which contain geometric shapes instead of numbers. Such squares, known as geometric magic squares, were invented and named by Lee Sallows in 2001.
In the example shown the shapes appearing are two dimensional. It is clear that all magic squares are geometric, in that the numbers that appear in numerical magic squares can be interpreted as a shorthand notation which indicates the lengths of straight line segments that are the geometric 'shapes' occurring in the square. That is, numerical magic squares are that special case of a geometric magic square using one dimensional shapes.
Area magic squares
[[File:Trump Walkington Taneja first linear area magic square 170106.jpg|thumb|168x168px|The first linear area magic square
]]
In 2017, following initial ideas of William Walkington and Inder Taneja, the first linear area magic square (L-AMS) was constructed by Walter Trump.
Other magic shapes
Other two dimensional shapes than squares can be considered. The general case is to consider a design with N parts to be magic if the N parts are labeled with the numbers 1 through N and a number of identical sub-designs give the same sum. Examples include magic circles, magic rectangles, magic triangles magic stars, magic hexagons, magic diamonds. Going up in dimension results in magic spheres, magic cylinders, magic cubes, magic parallelepiped, magic solids, and other magic hypercubes.
Possible magic shapes are constrained by the number of equal-sized, equal-sum subsets of the chosen set of labels. For example, if one proposes to form a magic shape labeling the parts with {1, 2, 3, 4}, the sub-designs will have to be labeled with {1,4} and {2,3}. though 12×12 ones do.]]
n-Queens problem
In 1992, Demirörs, Rafraf, and Tanik published a method for converting some magic squares into n-queens solutions, and vice versa.
<!----><!-- paper not listed in references --><!-- added reference -->
Magic squares in occultism
Magic squares of order 3 through 9, assigned to the seven planets, and described as means to attract the influence of planets and their angels (or demons) during magical practices, can be found in several manuscripts all around Europe starting at least since the 15th century. Among the best known, the Liber de Angelis, a magical handbook written around 1440, is included in Cambridge Univ. Lib. MS Dd.xi.45. The text of the Liber de Angelis is very close to that of De septem quadraturis planetarum seu quadrati magici, another handbook of planetary image magic contained in the Codex 793 of the Biblioteka Jagiellońska (Ms BJ 793). The magical operations involve engraving the appropriate square on a plate made with the metal assigned to the corresponding planet, as well as performing a variety of rituals. For instance, the 3×3 square, that belongs to Saturn, has to be inscribed on a lead plate. It will, in particular, help women during a difficult childbirth.
In about 1510 Heinrich Cornelius Agrippa wrote De Occulta Philosophia, drawing on the Hermetic and magical works of Marsilio Ficino and Pico della Mirandola. In its 1531 edition, he expounded on the magical virtues of the seven magical squares of orders 3 to 9, each associated with one of the astrological planets, much in the same way as the older texts did. This book was very influential throughout Europe until the Counter-Reformation, and Agrippa's magic squares, sometimes called kameas, continue to be used within modern ceremonial magic in much the same way as he first prescribed.
thumb|The derivation of the [[Sigil (magic)|sigil of Hagiel, the planetary intelligence of Venus, drawn on the magic square of Venus. Each Hebrew letter provides a numerical value, giving the vertices of the sigil.]]
The most common use for these kameas is to provide a pattern upon which to construct the sigils of spirits, angels or demons; the letters of the entity's name are converted into numbers, and lines are traced through the pattern that these successive numbers make on the kamea.
In a magical context, the term magic square is also applied to a variety of word squares or number squares found in magical grimoires, including some that do not follow any obvious pattern, and even those with differing numbers of rows and columns. They are generally intended for use as talismans. For instance the following squares are: The Sator square, one of the most famous magic squares found in a number of grimoires including the Key of Solomon; a square "to overcome envy", from The Book of Power; and two squares from The Book of the Sacred Magic of Abramelin the Mage, the first to cause the illusion of a superb palace to appear, and the second to be worn on the head of a child during an angelic invocation:
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| S || A || T || O || R
|-
| A || R || E || P || O
|-
| T || E || N || E || T
|-
| O || P || E || R || A
|-
| R || O || T || A || S
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:12em;height:8em;table-layout:fixed;"
|-
| 6 || 66 || 848 || 938
|-
| 8 || 11 || 544 || 839
|-
| 1 || 11 || 383 || 839
|-
| 2 || 73 || 774 || 447
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;table-layout:fixed;"
|-
| H || E || S || E || B
|-
| E || Q || A || L ||
|-
| S || || || ||
|-
| E || || G || ||
|-
| B || || || ||
|}
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:8em;height:10em;table-layout:fixed;"
|-
| A || D || A || M
|-
| D || A || R || A
|-
| A || R || A || D
|-
| M || A || D || A
|}
See also
- Antimagic square
- Arithmetic sequence
- Associative magic square
- Combinatorial design
- Freudenthal magic square
- Hexagonal tortoise problem
- John R. Hendricks
- Latin square
- Magic circle
- Magic cube
- Magic cube classes
- Magic polygon
- Magic series
- Square matrices
- Most-perfect magic square
- Nasik magic hypercube
- Prime reciprocal magic square
- Room square
- Sigil (magic)
- Sriramachakra
- Sudoku
- Unsolved problems in mathematics
- Vedic square
Notes
References
- Magic Squares at Convergence
- John Lee Fults, Magic Squares. (La Salle, Illinois: Open Court, 1974).
- Cliff Pickover, The Zen of Magic Squares, Circles, and Stars (Princeton, New Jersey: Princeton University Press)
- Leonhard Euler, On magic squares
- Leonhard Euler, Investigations on new type of magic square
- William H. Benson and Oswald Jacoby, "New Recreations with Magic Squares". (New York: Dover, 1976).
Further reading
External links
- Min Chen. Unlocking the Occult: 5 Mystical Symbols and Their Secret Histories // Artnet News — Oct. 30, 2025.
