The smallest (and uniqueup to rotation and reflection) non-trivial case of a magic square, order 3
Inmathematics, especiallyhistorical andrecreational mathematics, a square array of numbers, usuallypositive integers, is called amagic square if the sums of the numbers in each row, each column, and both main diagonals are the same.[1][2] Theorder of the magic square is the number of integers along one side (n), and the constant sum is called themagic constant. If the array includes just the positive integers, the magic square is said to benormal. 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 astrivial. Some well-known examples, including theSagrada 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 asemimagic square (sometimes calledorthomagic 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 ordern as: odd ifn is odd, evenly even (also referred to as "doubly even") ifn is a multiple of 4, oddly even (also known as "singly even") ifn 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 asassociative 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 forn ≤ 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.
The third-order magic square was known toChinese 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 fromBaghdadc. 983, theEncyclopedia 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 inShams Al-ma'arif, for occult purposes.[3] 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'sMelencolia (see the photograph of the work). Another one appears in Wilfredo Lam'sBélial, Emperor of the Flies, a magic square is seen in the lower left quadrant of the painting.[4]
A page displaying 9×9 magic square from Cheng Dawei'sSuanfa tongzong (1593).
While ancient references to the pattern of even and odd numbers in the 3×3 magic square appear in theI Ching, the first unequivocal instance of this magic square appears in the chapter calledMingtang (Bright Hall) of a 1st-century bookDa Dai Liji (Record of Rites by the Elder Dai), which purported to describe ancient Chinese rites of the Zhou dynasty.[5][6][7][8] These numbers also occur in a possibly earlier mathematical text calledShushu jiyi (Memoir on Some Traditions of Mathematical Art), said to be written in 190 BCE. This is the earliest appearance of a magic square on record; and it was mainly used for divination and astrology.[5] The 3×3 magic square was referred to as the "Nine Halls" by earlier Chinese mathematicians.[7] The identification of the 3×3 magic square to the legendary Luoshu chart was only made in the 12th century, after which it was referred to as the Luoshu square.[5][7] The oldest surviving Chinese treatise that displays magic squares of order larger than 3 isYang Hui'sXugu zheqi suanfa (Continuation of Ancient Mathematical Methods for Elucidating the Strange) written in 1275.[5][7] The contents of Yang Hui's treatise were collected from older works, both native and foreign; and he only explains the construction of third and fourth-order magic squares, while merely passing on the finished diagrams of larger squares.[7] He gives a magic square of order 3, two squares for each order of 4 to 8, one of order nine, and one semi-magic square of order 10. He also gives six magic circles of varying complexity.[9]
4
9
2
3
5
7
8
1
6
2
16
13
3
11
5
8
10
7
9
12
6
14
4
1
15
1
23
16
4
21
15
14
7
18
11
24
17
13
9
2
20
8
19
12
6
5
3
10
22
25
13
22
18
27
11
20
31
4
36
9
29
2
12
21
14
23
16
25
30
3
5
32
34
7
17
26
10
19
15
24
8
35
28
1
6
33
46
8
16
20
29
7
49
3
40
35
36
18
41
2
44
12
33
23
19
38
6
28
26
11
25
39
24
22
5
37
31
27
17
13
45
48
9
15
14
32
10
47
1
43
34
30
21
42
4
61
3
2
64
57
7
6
60
12
54
55
9
16
50
51
13
20
46
47
17
24
42
43
21
37
27
26
40
33
31
30
36
29
35
34
32
25
39
38
28
44
22
23
41
48
18
19
45
52
14
15
49
56
10
11
53
5
59
58
8
1
63
62
4
31
76
13
36
81
18
29
74
11
22
40
58
27
45
63
20
38
56
67
4
49
72
9
54
65
2
47
30
75
12
32
77
14
34
79
16
21
39
57
23
41
59
25
43
61
66
3
48
68
5
50
70
7
52
35
80
17
28
73
10
33
78
15
26
44
62
19
37
55
24
42
60
71
8
53
64
1
46
69
6
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.[7][8] The order 5 square is a bordered magic square, with central 3×3 square formed according to Luo Shu principle. The order 9 square is a composite magic square, in which the nine 3×3 sub squares are also magic.[7] After Yang Hui, magic squares frequently occur in Chinese mathematics such as in Ding Yidong'sDayan suoyin (c. 1300),Cheng Dawei'sSuanfa tongzong (1593), Fang Zhongtong'sShuduyan (1661) which contains magic circles, cubes and spheres, Zhang Chao'sXinzhai zazu (c. 1650), who published China's first magic square of order ten, and lastly Bao Qishou'sBinaishanfang ji (c. 1880), who gave various three dimensional magic configurations.[5][8] However, despite being the first to discover the magic squares and getting a head start by several centuries, the Chinese development of the magic squares are much inferior compared to the Indian, Middle Eastern, or European developments. The high point of Chinese mathematics that deals with the magic squares seems to be contained in the work of Yang Hui; but even as a collection of older methods, this work is much more primitive, lacking general methods for constructing magic squares of any order, compared to a similar collection written around the same time by the Byzantine scholarManuel Moschopoulos.[7] This is possibly because of the Chinese scholars' enthralment with the Lo Shu principle, which they tried to adapt to solve higher squares; and after Yang Hui and the fall ofYuan dynasty, their systematic purging of the foreign influences in Chinese mathematics.[7]
Japan and China have similar mathematical traditions and have repeatedly influenced each other in the history of magic squares.[10] The Japanese interest in magic squares began after the dissemination of Chinese works—Yang Hui'sSuanfa and Cheng Dawei'sSuanfa tongzong—in the 17th century, and as a result, almost all thewasans devoted their time to its study.
In the 1660 edition ofKetsugi-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.[11] InJinko-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 inDokai-sho (1666), Sato Seiko inKongenki (1666), and Hosino Sanenobu inKo-ko-gen Sho (1673).[12] One ofSeki Takakazu'sSeven 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.[13] 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) inRakusho-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 ofIchigen Kappo by Shukei Irie, Yoshisuke Matsunaga inHojin-Shin-jutsu, Yoshihiro Kurushima inKyushi Iko who rediscovered a method to produce the odd squares given by Agrippa,[14] andNaonobu Ajima.[15][16] 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.[16]
The 3×3 magic square in different orientations forming a non-normal 6×6 magic square, from an unidentified 19th century Indian manuscript.
The 3×3 magic square first appears in India inGargasamhita by Garga, who recommends its use to pacify the nine planets (navagraha). The oldest version of this text dates from 100 CE, but the passage on planets could not have been written earlier than 400 CE. The first dateable instance of 3×3 magic square in India occur in a medical textSiddhayog (c. 966 CE) by Vrnda, which was prescribed to women in labor in order to have easy delivery.[17]
The oldest dateable fourth order magic square in the world is found in an encyclopaedic work written byVarahamihira around 587 CE calledBrhat Samhita. The magic square is constructed for the purpose of making perfumes using 4 substances selected from 16 different substances. Each cell of the square represents a particular ingredient, while the number in the cell represents the proportion of the associated ingredient, such that the mixture of any four combination of ingredients along the columns, rows, diagonals, and so on, gives the total volume of the mixture to be 18. Although the book is mostly about divination, the magic square is given as a matter of combinatorial design, and no magical properties are attributed to it. The special features of this magic square were commented on by Bhattotpala (c. 900 CE)[18][17]
2
3
5
8
5
8
2
3
4
1
7
6
7
6
4
1
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 apan-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.[19]
The construction of 4th-order magic square is detailed in a work titledKaksaputa, composed by the alchemistNagarjuna around 10th century CE. All of the squares given by Nagarjuna are 4×4 magic squares, and one of them is calledNagarjuniya after him. Nagarjuna gave a method of constructing 4×4 magic square using a primary skeleton square, given an odd or even magic sum.[18] The Nagarjuniya square is given below, and has the sum total of 100.
30
16
18
36
10
44
22
24
32
14
20
34
28
26
40
6
7
1
4
6
2
8
5
3
5
3
2
8
4
6
7
1
The Nagarjuniya square is apan-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 ofParshvanath temple inKhajuraho, India. Several Jain hymns teach how to make magic squares, although they are undateable.[17]
As far as is known, the first systematic study of magic squares in India was conducted byThakkar Pheru, a Jain scholar, in hisGanitasara Kaumudi (c. 1315). This work contains a small section on magic squares which consists of nine verses. Here he gives a square of order four, and alludes to its rearrangement; classifies magic squares into three (odd, evenly even, and oddly even) according to its order; gives a square of order six; and prescribes one method each for constructing even and odd squares. For the even squares, Pheru divides the square into component squares of order four, and puts the numbers into cells according to the pattern of a standard square of order four. For odd squares, Pheru gives the method usinghorse move or knight's move. Although algorithmically different, it gives the same square as the De la Loubere's method.[17]
The next comprehensive work on magic squares was taken up byNarayana Pandit, who in the fourteenth chapter of hisGanita Kaumudi (1356) gives general methods for their construction, along with the principles governing such constructions. It consists of 55 verses for rules and 17 verses for examples. Narayana gives a method to construct all the pan-magic squares of fourth order using knight's move; enumerates the number of pan-diagonal magic squares of order four, 384, including every variation made by rotation and reflection; three general methods for squares having any order and constant sum when a standard square of the same order is known; two methods each for constructing evenly even, oddly even, and odd squares when the sum is given. While Narayana describes one older method for each species of square, he claims the method ofsuperposition for evenly even and odd squares and a method of interchange for oddly even squares to be his own invention. The superposition method was later re-discovered byDe la Hire in Europe. In the last section, he conceives of other figures, such as circles, rectangles, and hexagons, in which the numbers may be arranged to possess properties similar to those of magic squares.[18][17] Below are some of the magic squares constructed by Narayana:[18]
8
1
6
3
5
7
4
9
2
1
14
4
15
8
11
5
10
13
2
16
3
12
7
9
6
16
14
7
30
23
24
17
10
8
31
32
25
18
11
4
5
28
26
19
12
13
6
29
22
20
1
35
4
33
32
6
25
11
9
28
8
30
24
14
18
16
17
22
13
23
19
21
20
15
12
26
27
10
29
7
36
2
34
3
5
31
35
26
17
1
62
53
44
46
37
21
12
3
64
55
57
41
32
23
14
5
66
61
52
43
34
25
16
7
2
63
54
45
36
27
11
13
4
65
56
47
31
22
24
15
6
67
51
42
33
60
53
44
37
4
13
20
29
3
14
19
30
59
54
43
38
58
55
42
39
2
15
18
31
1
16
17
32
57
56
41
40
61
52
45
36
5
12
21
28
6
11
22
27
62
51
46
35
63
50
47
34
7
10
23
26
8
9
24
25
64
49
48
33
The order 8 square is interesting in itself since it is an instance of the most-perfect magic square. Incidentally, Narayana states that the purpose of studying magic squares is to constructyantra, to destroy the ego of bad mathematicians, and for the pleasure of good mathematicians. The subject of magic squares is referred to asbhadraganita and Narayana states that it was first taught to men by godShiva.[17]
A 6×6 magic square fromBook of Wonders (from 16th century manuscript).
Although the early history of magic squares in Persia and Arabia is not known, it has been suggested that they were known in pre-Islamic times.[20] It is clear, however, that the study of magic squares was common inmedieval Islam, and it was thought to have begun after the introduction ofchess into the region.[21][22][23] The first dateable appearance of a magic square of order 3 occurs inJā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.[8] While it is known that treatises on magic squares were written in the 9th century, the earliest extant treaties date from the 10th-century: one byAbu'l-Wafa al-Buzjani (c. 998) and another by Ali b. Ahmad al-Antaki (c. 987).[22][24][25] These early treatises were purely mathematical, and the Arabic designation for magic squares used iswafq al-a'dad, which translates asharmonious disposition of the numbers.[23] By the end of 10th century, the two treatises by Buzjani and Antaki makes it clear that the Middle Eastern mathematicians had understood how to construct bordered squares of any order as well as simple magic squares of small orders (n ≤ 6) which were used to make composite magic squares.[22][24] A specimen of magic squares of orders 3 to 9 devised by Middle Eastern mathematicians appear in an encyclopedia fromBaghdadc. 983, theRasa'il Ikhwan al-Safa (theEncyclopedia of the Brethren of Purity).[26] The squares of order 3 to 7 from Rasa'il are given below:[26]
2
7
6
9
5
1
4
3
8
4
14
15
1
9
7
6
12
5
11
10
8
16
2
3
13
21
3
4
12
25
15
17
6
19
8
10
24
13
2
16
18
7
20
9
11
1
14
22
23
5
11
22
32
5
23
18
25
16
7
30
13
20
27
6
35
36
4
3
10
31
1
2
33
34
14
19
8
29
26
15
24
17
28
9
12
21
47
11
8
9
6
45
49
4
37
20
17
16
35
46
2
18
26
21
28
32
48
43
19
27
25
23
31
7
38
36
22
29
24
14
12
40
15
30
33
34
13
10
1
39
42
41
44
5
3
The 11th century saw the finding of several ways to construct simple magic squares for odd and evenly even orders; the more difficult case of oddly even case (n = 4k + 2) was solved byIbn al-Haytham withk even (c. 1040), and completely by the beginning of 12th century, if not already in the latter half of the 11th century.[22] Around the same time, pandiagonal squares were being constructed. Treaties on magic squares were numerous in the 11th and 12th century. These later developments tended to be improvements on or simplifications of existing methods. From the 13th century onwards, magic squares were increasingly put to occult purposes.[22] However, much of these later texts written for occult purposes merely depict certain magic squares and mention their attributes, without describing their principle of construction, with only some authors keeping the general theory alive.[22] One such occultist was the AlgerianAhmad al-Buni (c. 1225), who gave general methods on constructing bordered magic squares; some others were the 17th century Egyptian Shabramallisi and the 18th century Nigerian al-Kishnawi.[27]
The magic square of order three was described as a child-bearing charm[28][29] since its first literary appearances in the alchemical works ofJābir ibn Hayyān (fl. c. 721 – c. 815)[29][30] andal-Ghazālī (1058–1111)[31] 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 scholarIbn Zarkali's (known as Azarquiel in Europe) (1029–1087)Kitāb tadbīrāt al-kawākib (Book on the Influences of the Planets).[32] A century later, the Algerian scholar Ahmad al-Buni attributed mystical properties to magic squares in his highly influential bookShams al-Ma'arif (The Book of the Sun of Gnosis and the Subtleties of Elevated Things), which also describes their construction. This tradition about a series of magic squares from order three to nine, which are associated with the seven planets, survives in Greek, Arabic, and Latin versions.[33] There are also references to the use of magic squares in astrological calculations, a practice that seems to have originated with the Arabs.[34][35]
This page fromAthanasius Kircher'sOedipus Aegyptiacus (1653) belongs to a treatise on magic squares and shows theSigillum 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 scholarManuel 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.[36] 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 inKitā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.[32] The magic square of three was discussed in numerological manner in early 12th century by Jewish scholar Abraham ibn Ezra of Toledo, which influenced later Kabbalists.[37] Ibn Zarkali's work was translated asLibro de Astromagia in the 1280s,[38] due toAlfonso X of Castille.[39][32] 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.[40][32]
Magic squares surface again in Florence, Italy in the 14th century. A 6×6 and a 9×9 square are exhibited in a manuscript of theTrattato d'Abbaco (Treatise of the Abacus) byPaolo Dagomari.[41][42] 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 FlorentineLuca Pacioli, who describes 3×3 to 9×9 squares in his workDe Viribus Quantitatis by the end of 15th century.[43][44]
A page from Simon de la Loubère'sDu 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 ofPicatrix 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 ofParacelsus inArchidoxa Magica (1567), although in highly garbled form. In 1514Albrecht Dürer immortalized a 4×4 square in his famous engravingMelencolia I. Paracelsus' contemporaryHeinrich Cornelius Agrippa von Nettesheim published his famous three volume bookDe occulta philosophia in 1531, where he devoted Chapter 22 of Book II to the planetary squares shown below.[37] The same set of squares given by Agrippa reappear in 1539 inPractica Arithmetice byGirolamo Cardano, where he explains the construction of the odd ordered squares using "diamond method", which was later reproduced by Bachet.[45] The tradition of planetary squares was continued into the 17th century byAthanasius Kircher inOedipi Aegyptici (1653). In Germany, mathematical treaties concerning magic squares were written in 1544 byMichael Stifel inArithmetica Integra, who rediscovered the bordered squares, andAdam Riese, who rediscovered the continuous numbering method to construct odd ordered squares published by Agrippa. However, due to the religious upheavals of that time, these works were unknown to the rest of Europe.[37]
In 1624 France,Claude Gaspard Bachet described the "diamond method" for constructing Agrippa's odd ordered squares in his bookProblèmes Plaisants. During 1640Bernard Frenicle de Bessy andPierre Fermat exchanged letters on magic squares and cubes, and in one of the letters Fermat boasts of being able to construct 1,004,144,995,344 magic squares of order 8 by his method.[45] An early account on the construction of bordered squares was given byAntoine Arnauld in hisNouveaux éléments de géométrie (1667).[46] In the two treatiseDes quarrez ou tables magiques andTable 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.[45] In 1691,Simon de la Loubère described the Indian continuous method of constructing odd ordered magic squares in his bookDu Royaume de Siam, which he had learned while returning from a diplomatic mission to Siam, which was faster than Bachet's method. In an attempt to explain its working, de la Loubere used the primary numbers and root numbers, and rediscovered the method of adding two preliminary squares. This method was further investigated by Abbe Poignard inTraité des quarrés sublimes (1704), byPhilippe de La Hire inMémoires de l'Académie des Sciences for the Royal Academy (1705), and byJoseph Sauveur inConstruction des quarrés magiques (1710). Concentric bordered squares were also studied by De la Hire in 1705, while Sauveur introduced magic cubes and lettered squares, which was taken up later byEuler in 1776, who is often credited for devising them. In 1750 d'Ons-le-Bray rediscovered the method of constructing doubly even and singly even squares using bordering technique; while in 1767Benjamin Franklin published a semi-magic square which had the properties of eponymous Franklin square.[47] 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.[37][48]
In the 19th century, Bernard Violle gave a comprehensive treatment of magic squares in his three volumeTraité 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 inTheory of magic squares and of magic cubes (1888).[48] In 1897, Emroy McClintock publishedOn the most perfect form of magic squares, coining the wordspandiagonal square andmost perfect square, which had previously been referred to as perfect, or diabolic, or Nasik.
Legends dating from as early as 650 BCE tell the story of theLo Shu (洛書) or "scroll of the river Lo".[8] According to the legend, there was at one time inancient China a huge flood. While thegreat king Yu was trying to channel the water out to sea, aturtle 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.[citation needed] TheLo 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.
There is a well-known 12th-century 4×4 normal magic square inscribed on the wall of theParshvanath temple inKhajuraho, India.[18][17][49]
7
12
1
14
2
13
8
11
16
3
10
5
9
6
15
4
This is known as theChautisa Yantra (Chautisa, 34;Yantra, lit. "device"), since its magic sum is 34. It is one of the three 4×4pandiagonal magic squares and is also an instance of themost-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.
The order four normal magic squareAlbrecht Dürer immortalized in his 1514 engravingMelencolia 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 toYang 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 fourqueens in the two solutions of the4 queens puzzle[50]), 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.
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.[51]
A magic square on the Sagrada Família church façade
The Passion façade of theSagrada Família church inBarcelona, conceptualized byAntoni Gaudí and designed by sculptorJosep Subirachs, features a trivial order 4 magic square: The magic constant of the square is 33, the age ofJesus at the time of thePassion.[52] Structurally, it is very similar to theMelancholia magic square, but it has had the numbers in four of the cells reduced by 1.
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.[53]
Similarly to Dürer's magic square, the Sagrada Familia's magic square can also be extended to a magic cube.[54]
The constant that is the sum of any row, or column, or diagonal is called themagic constant or magic sum,M. Every normal magic square has a constant dependent on the ordern, calculated by the formula. This can be demonstrated by noting that the sum of is. Since the sum of each row is, the sum of rows is, which when divided by the ordern yields the magic constant as. For normal magic squares of ordersn = 3, 4, 5, 6, 7, and 8, the magic constants are, respectively: 15, 34, 65, 111, 175, and 260 (sequenceA006003 in theOEIS).
The 1×1 magic square, with only one cell containing the number 1, is calledtrivial, 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.
If the numbers in the magic square are seen as masses located in various cells, then thecenter of mass of a magic square coincides with its geometric center.
Themoment 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.[56] (Thus for example a corner cell of a 3×3 square has a distance of 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 then×n case the moment of inertia is[56]
Dividing each number of the magic square by the magic constant will yield adoubly stochastic matrix, whose row sums and column sums equal to unity. However, unlike the doubly stochastic matrix, the diagonal sums of such matrices will also equal to unity. Thus, such matrices constitute a subset of doubly stochastic matrix. The Birkhoff–von Neumann theorem states that for any doubly stochastic matrix, there exists real numbers, where andpermutation matrices such that
This representation may not be unique in general. By Marcus-Ree theorem, however, there need not be more than terms in any decomposition.[57] 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.
Euler diagram of the properties of some types of 4×4 magic squares. Cells of the same colour sum to the magic constant. * 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. Ann×n square array of integers 1, 2, ...,n2 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 asordinary magic squares ornormal magic squares.
Self-complementary magic square when it is a magic square which when complemented (i.e. each number subtracted fromn2 + 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 givesn2 + 1. They are also calledsymmetric 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 calledpanmagic squares,perfect squares,diabolic squares,Jain squares, orNasik 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 ordersn ≥ 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 calledconcentric 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 asinlays.
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 wheren = 4k, and (ii) all pairs of integers distantn/2 along any diagonal (major or broken) are complementary (i.e. they sum ton2 + 1). The first property is referred to ascompactness, while the second property is referred to ascompleteness. 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 iscompact.
Multimagic square when it is a magic square that remains magic even if all its numbers are replaced by theirk-th power for 1 ≤k ≤P. They are also known asP-multimagic square orsatanic squares. They are also referred to asbimagic squares,trimagic squares,tetramagic squares, andpentamagic squares when the value ofP is 2, 3, 4, and 5 respectively.
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 singleequivalence class-all equivalent to the Lo Shu square. Thus there is basically just one normal magic square of order 3.
The number of differentn ×n magic squares forn from 1 to 6, not counting rotations and reflections is:
1, 0, 1, 880, 275305224, 17753889197660635632. (sequenceA006052 in theOEIS)
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 ordern from 1 to 5, is:
1, 0, 1, 255, 251449712 (sequenceA270876 in theOEIS).
Higher-order squares and tori
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.[58]
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.[59][citation needed]
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 theMonte Carlo method has been applied. The basic principle applied to magic squares is to randomly generaten ×n matrices of elements 1 ton2 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.[60]
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.
A magic square remains magic when its numbers are multiplied by any constant.[61]
A magic square remains magic when a constant is added or subtracted to its numbers, or if its numbers are subtracted from a constant. In particular, if every element in a normal magic square is subtracted fromn2 + 1, the resulting square is thecomplement of the original square.[61] In the example below, elements of 4×4 square on the left is subtracted from 17 to obtain the complement of the square on the right.
10
3
13
8
5
16
2
11
4
9
7
14
15
6
12
1
7
14
4
9
12
1
15
6
13
8
10
3
2
11
5
16
The numbers of a magic square can be substituted with corresponding numbers from a set ofs arithmetic progressions with the same common difference amongr terms, such thatr × s =n2, and whose initial terms are also in arithmetic progression, to obtain a non-normal magic square. Here eithers orr should be a multiple ofn. Let us haves arithmetic progressions given by
wherea is the initial term,c is the common difference of the arithmetic progressions, andd is the common difference among the initial terms of each progression. The new magic constant will be
Ifs =r =n, then we have the simplification
If we further havea =c = 1 andd =n, we obtain the usualM =n(n2+1)/2. For givenM we can find the requireda,c, andd by solving thelinear Diophantine equation. In the examples below, we have order 4 normal magic square on the left most side. The second square is a corresponding non-normal magic square withr = 8,s = 2,a = 1,c = 1, andd = 10 such that the new magic constant isM = 38. The third square is an order 5 normal magic square, which is a 90 degree clockwise rotated version of the square generated by De la Loubere method. On the right most side is a corresponding non-normal magic square witha = 4,c = 1, andd = 6 such that the new magic constant isM = 90.
1
15
14
4
12
6
7
9
8
10
11
5
13
3
2
16
1
17
16
4
14
6
7
11
8
12
13
5
15
3
2
18
11
10
4
23
17
18
12
6
5
24
25
19
13
7
1
2
21
20
14
8
9
3
22
16
15
16
14
7
30
23
24
17
10
8
31
32
25
18
11
4
5
28
26
19
12
13
6
29
22
20
Any magic square can berotated andreflected to produce 8 trivially distinct squares. In magic square theory, all of these are generally deemed equivalent and the eight such squares are said to make up a singleequivalence class.[62][61] 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:
8
1
6
3
5
7
4
9
2
6
1
8
7
5
3
2
9
4
2
7
6
9
5
1
4
3
8
4
3
8
9
5
1
2
7
6
2
9
4
7
5
3
6
1
8
4
9
2
3
5
7
8
1
6
8
3
4
1
5
9
6
7
2
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.[61][48] For an even square, there aren/2 pairs of rows and columns that can be interchanged; thus we can obtain 2n/2 equivalent magic squares by combining such interchanges. For odd square, there are (n−1)/2 pairs of rows and columns that can be interchanged; and 2(n−1)/2 equivalent magic squares obtained by combining such interchanges. Interchanging all the rows and columns rotates the square by 180 degree. In the example using a 4×4 magic square, the left square is the original square, while the right square is the new square obtained by interchanging the 1st and 4th rows and columns.
1
15
14
4
12
6
7
9
8
10
11
5
13
3
2
16
16
3
2
13
9
6
7
12
5
10
11
8
4
15
14
1
Given any magic square, another magic square of the same order can be formed by interchanging two rows on one side of the center line, and then interchanging the corresponding two rows on the other side of the center line; then interchanging like columns. For an even square, since there aren/2 same sided rows and columns, there aren(n−2)/8 pairs of such rows and columns that can be interchanged. Thus we can obtain 2n(n−2)/8 equivalent magic squares by combining such interchanges. For odd square, since there are (n−1)/2 same sided rows and columns, there are (n−1)(n−3)/8 pairs of such rows and columns that can be interchanged. Thus, there are 2(n−1)(n−3)/8 equivalent magic squares obtained by combining such interchanges. Interchanging every possible pairs of rows and columns rotates each quadrant of the square by 180 degree. In the example using a 4×4 magic square, the left square is the original square, while the right square is the new square obtained by this transformation. In the middle square, row 1 has been interchanged with row 2; and row 3 and 4 has been interchanged. The final square on the right is obtained by interchanging columns 1 and 2, and columns 3 and 4 of the middle square. In this particular example, this transform amounts to rotating the quadrants by 180 degree. The middle square is also a magic square, since the original square is an associative magic square.
1
15
14
4
12
6
7
9
8
10
11
5
13
3
2
16
12
6
7
9
1
15
14
4
13
3
2
16
8
10
11
5
6
12
9
7
15
1
4
14
3
13
16
2
10
8
5
11
A magic square remains magic when any of its non-central rowsx andy are interchanged, along with the interchange of their complementary rowsn −x + 1 andn −y + 1; and then interchanging like columns. This is a generalization of the above two transforms. Wheny =n −x + 1, this transform reduces to the first of the above two transforms. Whenx andy are on the same side of the center line, this transform reduces to the second of the above two transforms. In the example below, the original square is on the left side, while the final square on the right. The middle square has been obtained by interchanging rows 1 and 3, and rows 2 and 4 of the original square. The final square on the right is obtained by interchanging columns 1 and 3, and columns 2 and 4 of the middle square. In this example, this transform amounts to interchanging the quadrants diagonally. Since the original square is associative, the middle square also happens to be magic.
1
15
14
4
12
6
7
9
8
10
11
5
13
3
2
16
8
10
11
5
13
3
2
16
1
15
14
4
12
6
7
9
11
5
8
10
2
16
13
3
14
4
1
15
7
9
12
6
A magic square remains magic when its quadrants are diagonally interchanged because this is another symmetric permutation of the form described above. For even-order, permute the rows and columns by permutation where for, and for. For odd-order, permute rows and columns by permutation where for, and for. For odd ordered square, the halves of the central row and column are also interchanged.[61] Examples for order 4 and 5 magic squares are given below:
An associative magic square remains associative when two rows or columns equidistant from the center are interchanged.[63][64] For an even square, there aren/2 pairs of rows or columns that can be interchanged; thus{{{1}}} equivalent magic squares by combining such interchanges can be obtained. For odd square, there are(n − 1)/2 pairs of rows or columns that can be interchanged; and 2n−1 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.
16
3
2
13
9
6
7
12
5
10
11
8
4
15
14
1
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).[63][64] For an even square, since there aren/2 same sided rows (or columns), there aren(n − 2)/8 pairs of such rows (or columns) that can be interchanged. Thus, 2n(n − 2)/8 × 2n(n − 2)/8 = 2n(n − 2)/4 equivalent magic squares can be obtained by combining such interchanges. For odd square, since there are (n − 1)/2 same sided rows or columns, there are (n − 1)(n − 3)/8 pairs of such rows or columns that can be interchanged. Thus, there are 2(n − 1)(n − 3)/8 × 2(n − 1)(n − 3)/8 = 2(n − 1)(n − 3)/4 equivalent magic squares obtained by combining such interchanges. Interchanging all the same sided rows flips each quadrants of the square vertically, while interchanging all the same sided columns flips each quadrant of the square horizontally. In the example below, the original square is on the left, whose rows 1 and 2 are interchanged with each other, along with rows 3 and 4, to obtain the transformed square on the right.
A pan-diagonal magic square remains a pan-diagonal magic square under cyclic shifting of rows or of columns or both.[61] This allows us to position a given number in any one of then2 cells of ann order square. Thus, for a given pan-magic square, there aren2 equivalent pan-magic squares. In the example below, the original square on the left is transformed by shifting the first row to the bottom to obtain a new pan-magic square in the middle. Next, the 1st and 2nd column of the middle pan-magic square is circularly shifted to the right to obtain a new pan-magic square on the right.
A bordered magic square remains a bordered magic square after permuting the border cells in the rows or columns, together with their corresponding complementary terms, keeping the corner cells fixed. Since the cells in each row and column of every concentric border can be permuted independently, when the ordern ≥ 5 is odd, there are equivalent bordered squares. Whenn ≥ 6 is even, there are equivalent bordered squares. In the example below, a square of order 5 is given whose border row has been permuted and (3!)2 = 36 such equivalent squares can be obtained.
1
23
16
4
21
15
14
7
18
11
24
17
13
9
2
20
8
19
12
6
5
3
10
22
25
1
16
23
4
21
15
14
7
18
11
24
17
13
9
2
20
8
19
12
6
5
10
3
22
25
A bordered magic square remains a bordered magic square after each of its concentric borders are independently rotated or reflected with respect to the central core magic square. If there areb borders, then this transform will yield 8b equivalent squares. In the example below of the 5×5 magic square, the border has been rotated 90 degrees anti-clockwise.
A composite magic square remains a composite magic square when the embedded magic squares undergo transformations that do not disturb the magic property (e.g. rotation, reflection, shifting of rows and columns, and so on).
Over the millennia, many ways to constructmagic squares have been discovered. These methods can be classified as general methods and special methods, in the sense that general methods allow us to construct more than a single magic square of a given order, whereas special methods allow us to construct just one magic square of a given order. Special methods are specific algorithms whereas general methods may require some trial-and-error.
Special methods are the most simple ways to construct magic squares. They follow certain algorithms which generate regular patterns of numbers in a square. The correctness of these special methods can be proved using one of the general methods given in later sections. After a magic square has been constructed using a special method, the transformations described in the previous section can be applied to yield further magic squares. Special methods are usually referred to using the name of the author(s) (if known) who described the method, for e.g. De la Loubere's method, Starchey's method, Bachet's method, etc.
Magic squares are believed to exist for all orders, except for order 2. Magic squares can be classified according to their order as odd, doubly even (n divisible by four), and singly even (n even, but not divisible by four). This classification is based on the fact that entirely different techniques need to be employed to construct these different species of squares. Odd and doubly even magic squares are easy to generate; the construction of singly even magic squares is more difficult but several methods exist, includingJohn Horton Conway'sLUX method for magic squares and theStrachey method for magic squares.
Solving partially completed magic squares is a popular mathematical pastime. The techniques needed are similar to those used inSudoku orKenKen puzzles, and involve deducing the values of unfilled squares using logic andpermutation group theory (Sudoku grids arenot magic squares but are based on a related idea calledGraeco-Latin squares).[59]
Certain extra restrictions can be imposed on magic squares.
If raising each number to thenth power yields another magic square, the result is a bimagic (n = 2), a trimagic (n = 3), or, in general, amultimagic square.
A magic square in which the number of letters in the name of each number in the square generates another magic square is called analphamagic square.
TheGreen–Tao theorem implies that there are arbitrarily large magic squares consisting of primes.
The following "reversible magic square" has a magic constant of 264 both upside down and right way up:[65]
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 bySrinivasa 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.
Instead ofadding the numbers in each row, column and diagonal, one can apply some other operation. For example, a multiplicative magic square has a constantproduct 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 thelogarithm of the product of 2 numbers is the sum of logarithm of each. Alternatively, if any 3 numbers in a line are 2a, 2b and 2c, their product is 2a+b+c, which is constant ifa+b+c is constant, as they would be ifa,b andc were taken from ordinary (additive) magic square.[66] For example, the original Lo-Shu magic square becomes:
M = 32768
16
512
4
8
32
128
256
2
64
Other examples of multiplicative magic squares include:
Still usingAli Skalli's non iterative method, it is possible to produce an infinity of multiplicative magic squares ofcomplex numbers[67] belonging to 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.The product is:−352,507,340,640 − 400,599,719,520i.
Additive-multiplicative magic squares and semimagic squares satisfy properties of both ordinary and multiplicative magic squares and semimagic squares, respectively.[68]
First known additive-multiplicative magic square 8×8 found by W. W. Horner in 1955 Sum = 840 Product =2058068231856000
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
Smallest known additive-multiplicative semimagic square 4×4 found by L. Morgenstern in 2007 Sum = 247 Product =3369600
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.[69]
Smallest known additive-multiplicative magic square 7×7 found by Sébastien Miquel(Sébastien Miquel) in August 2016 Sum = 465 Product =150885504000
Magic squares may be constructed which contain geometric shapes instead of numbers. Such squares, known asgeometric magic squares, were invented and named byLee Sallows in 2001.[70]
In the example shown the shapes appearing are two dimensional. It is clear thatall 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.[71]
In 2017, following initial ideas of William Walkington and Inder Taneja, the first linear area magic square (L-AMS) was constructed byWalter Trump.[72][73]
Other two dimensional shapes than squares can be considered. The general case is to consider a design withN parts to be magic if theN parts are labeled with the numbers 1 throughN and a number of identical sub-designs give the same sum. Examples includemagic circles, magic rectangles,magic triangles[74]magic stars,magic hexagons, magic diamonds. Going up in dimension results in magic spheres, magic cylinders,magic cubes, magic parallelepiped, magic solids, and othermagic 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}.[74]
A semimagic square (its diagonals do not sum to its magic constant, 260) also forming aknight's tour – no 8×8 fully magic tours exist,[75] though 12×12 ones do.[76]
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, theLiber de Angelis, a magical handbook written around 1440, is included in Cambridge Univ. Lib. MS Dd.xi.45.[78] The text of theLiber de Angelis is very close to that ofDe 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).[79] The magical operations involve engraving the appropriate square on a plate made with the metal assigned to the corresponding planet,[80] 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 1510Heinrich Cornelius Agrippa wroteDe Occulta Philosophia, drawing on theHermetic andmagical works ofMarsilio Ficino andPico 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 theastrological planets, much in the same way as the older texts did. This book was very influential throughout Europe until theCounter-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.[81]
The derivation of thesigil of Hagiel, theplanetary intelligence ofVenus, drawn on the magic square of Venus. EachHebrew 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 ordemons; 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 termmagic square is also applied to a variety ofword squares or number squares found in magicalgrimoires, 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: TheSator square, one of the most famous magic squares found in a number of grimoires including theKey of Solomon; a square "to overcome envy", fromThe Book of Power;[82] and two squares fromThe 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 angelicinvocation:
^The most famous Arabic book on magic, named "Shams Al-ma'arif (Arabic:كتاب شمس المعارف), forAhmed bin Ali Al-boni, who died about 1225 (622 AH). Reprinted inBeirut in 1985
^Veronica Simpson. (Sept. 14, 2016). The EY Exhibition: Wifredo LamStudio International
^abcdeYoke, Ho Peng (2008). "Magic Squares in China".Encyclopaedia of the History of Science, Technology, and Medicine in Non-Western Cultures. Encyopaedia of the History of Science, Technology, and Medicine in Non-Western Cultures (2 ed.). Springer. pp. 1252–1259.doi:10.1007/978-1-4020-4425-0_9350.ISBN978-1-4020-4559-2.
^Andrews, William Symes (1917).Magic Squares and Cubes (2nd ed.). Open Court Publishing Company. p. 122.
^Michiwaki, Yoshimasa (2008). "Magic Squares in Japanese Mathematics".Encyclopaedia of the History of Science, Technology, and Medicine in Non-Western Cultures. Encyopaedia of the History of Science, Technology, and Medicine in Non-Western Cultures (2 ed.). Springer. pp. 1252–1259.doi:10.1007/978-1-4020-4425-0_9154.ISBN978-1-4020-4559-2.
^abcdefgHayashi, Takao (2008). "Magic Squares in Indian Mathematics".Encyclopaedia of the History of Science, Technology, and Medicine in Non-Western Cultures (2 ed.). Springer. pp. 1252–1259.doi:10.1007/978-1-4020-4425-0_9778.ISBN978-1-4020-4559-2.
^abcdeDatta, Bibhutibhusan; Singh, Awadhesh Narayan (1992)."Magic Squares in India"(PDF).Indian Journal of History of Science.27 (1):51–120. Archived fromthe original(PDF) on 2018-01-17. Retrieved2018-01-16.
^abSesiano, Jacques (1997). "Magic squares in Islamic mathematics".Encyclopaedia of the History of Science, Technology, and Medicine in Non-Western Cultures. pp. 1259–1260.
^abSesiano, Jacques (2007).Magic squares in the tenth century: Two Arabic treatises by Antaki and Buzjani. Springer.
^Sesiano, J.,Abūal-Wafā\rasp's treatise on magic squares (French), Z. Gesch. Arab.-Islam. Wiss. 12 (1998), 121–244.
^abCammann, Schuyler (February 1969). "Islamic and Indian Magic Squares, Part I".History of Religions.8 (3):181–209.doi:10.1086/462584.S2CID162095408.
^Sesiano, Jacques (2004). "Quelques methodes arabes de construction des carres magiques impairs (some Arabic construction methods of odd magical squares)".Bulletin de la Société Vaudoise des Sciences Naturelles (in French).83 (1):51–76.
^Peter, J. Barta, The Seal-Ring of Proportion and the magic rings (2016), pp. 6–9.
^Jābir ibn Hayyān, Book of the Scales. French translation in: Marcelin Berthelot (1827–1907), Histoire de sciences. La chimie au moyen âge, Tom. III: L'alchimie arabe. Paris, 1893. [rprt.. Osnabruck: O. Zeller, 1967], pp. 139–162, in particular: pp. 150–151
^al-Ghazālī, Deliverance From Error (al-munqidh min al-ḍalāl ) ch. 145. Arabic: al-Munkidh min al-dalal. ed. J. Saliba – K. Ayyad. Damascus: Maktab al-Nashr al-'Arabi, 1934, p. 79. English tr.: Richard Joseph McCarthy, Freedom and Fulfillment: An annotated translation of al-Ghazali's al-Munkidh min al-Dalal and other relevant works of al-Ghazali. Boston, Twayer, 1980. He refers a book titled 'The Marvels of Special Properties' as his source. This square was named in the Orient as theSeal of Ghazali after him.
^abcdComes, Rosa (2016). "The Transmission of Azarquiel's Magic Squares in Latin Europe". In Wallis, Faith; Wisnovsky, Robert (eds.).Medieval Textual Cultures: Agents of Transmission, Translation and Transformation. Judaism, Christianity, and Islam – Tension, Transmission, Transformation. Vol. 6. Walter de Gruyter GmbH & Co KG. pp. 159–198.ISBN978-3-11-046730-7.
^The Latin version is Liber de septem figuris septem planetarum figurarum Geberi regis Indorum. This treatise is the identified source of Dürer and Heinrich Cornelius Agrippa von Nettesheim. Cf. Peter, J. Barta, The Seal-Ring of Proportion and the magic rings (2016), pp. 8–9, n. 10
^Sesiano, Jacques (2004).Les carrés magiques dans les pays islamiques (in French). PPUR presses polytechniques.
^Schimmel, Annemarie (1993).The mystery of numbers. New York: Oxford University Press.
^presently in the Biblioteca Vaticana (cod. Reg. Lat. 1283a)
^SeeAlfonso X el Sabio, Astromagia (Ms. Reg. lat. 1283a), a cura di A.D'Agostino, Napoli, Liguori, 1992
^Mars magic square appears in figure 1 of "Saturn and Melancholy: Studies in the History of Natural Philosophy, Religion, and Art" byRaymond Klibansky,Erwin Panofsky andFritz Saxl, Basic Books (1964)
^The squares can be seen on folios 20 and 21 of MS. 2433, at the Biblioteca Universitaria of Bologna. They also appear on folio 69rv of Plimpton 167, a manuscript copy of theTrattato dell'Abbaco from the 15th century in the Library of Columbia University.
^In a 1981 article ("Zur Frühgeschichte der magischen Quadrate in Westeuropa" i.e. "Prehistory of Magic Squares in Western Europe", Sudhoffs Archiv Kiel (1981) vol. 65, pp. 313–338) German scholar Menso Folkerts lists several manuscripts in which the "Trattato d'Abbaco" by Dagomari contains the two magic square. Folkerts quotes a 1923 article by Amedeo Agostini in the Bollettino dell'Unione Matematica Italiana: "A. Agostini in der Handschrift Bologna, Biblioteca Universitaria, Ms. 2433, f. 20v–21r; siehe Bollettino della Unione Matematica Italiana 2 (1923), 77f. Agostini bemerkte nicht, dass die Quadrate zur Abhandlung des Paolo dell'Abbaco gehören und auch in anderen Handschriften dieses Werks vorkommen, z. B. New York, Columbia University, Plimpton 167, f. 69rv; Paris, BN, ital. 946, f. 37v–38r; Florenz, Bibl. Naz., II. IX. 57, f. 86r, und Targioni 9, f. 77r; Florenz, Bibl. Riccard., Ms. 1169, f. 94–95."
^Pacioli states:A lastronomia summamente hanno mostrato li supremi di quella commo Ptolomeo, al bumasar ali, al fragano, Geber et gli altri tutti La forza et virtu de numeri eserli necessaria (Masters of astronomy, such asPtolemy,Albumasar,Alfraganus,Jabir and all the others, have shown that the force and the virtue of numbers are necessary to that science) and then goes on to describe the seven planetary squares, with no mention of magical applications.
^Demirörs, O.; Rafraf, N.; Tanik, M. M. "Obtainingn-queens solutions from magic squares and constructing magic squares fromn-queens solutions".Journal of Recreational Mathematics.24 (272–280): 1992.
^See Juris Lidaka,The Book of Angels, Rings, Characters and Images of the Planets inConjuring Spirits, C. Fangier ed. (Pennsylvania State University Press, 1994)
^Benedek Láng,Demons in Krakow, and Image Magic in a Magical Handbook, inChristian Demonology and Popular Mythology, Gábor Klaniczay and Éva Pócs eds. (Central European University Press, 2006)
^According to the correspondence principle, each of the seven planets is associated to a given metal: lead to Saturn, iron to Mars, gold to the Sun, etc.
^"The Book of Power: Cabbalistic Secrets of Master Aptolcater, Mage of Adrianople", transl. 1724. InShah, Idries (1957).The Secret Lore of Magic. London: Frederick Muller Ltd.