Professional Documents
Culture Documents
Magic Square PDF
Magic Square PDF
Magic Square PDF
In recreational mathematics, a magic square is an ar- mythical significance, and have appeared as symbols in
rangement of distinct numbers (i.e. each number is used works of art. In modern times they have been generalized
once), usually integers, in a square grid, where the num- a number of ways, including using extra or different con-
bers in each row, and in each column, and the numbers in straints, multiplying instead of adding cells, using alter-
the main and secondary diagonals, all add up to the same nate shapes or more than two dimensions, and replacing
number. A magic square has the same number of rows numbers with shapes and addition with geometric opera-
as it has columns, and in conventional math notation, "n" tions.
stands for the number of rows (and columns) it has. Thus,
a magic square always contains n2 numbers, and its size
(the number of rows [and columns] it has) is described 1 History
as being “of order n".* [1] A magic square that contains
the integers from 1 to n2 is called a normal magic square.
(The term“magic square”is also sometimes used to refer
to any of various types of word squares.)
Normal magic squares of all sizes except 2 × 2 (that is,
where n = 2) can be constructed. The 1 × 1 magic square,
with only one cell containing the number 1, is trivial. The
smallest (and unique up to rotation and reflection) non-
trivial case, 3 × 3, is shown below.
1
2 1 HISTORY
ing to the legend, there was at one time in ancient China not known, it has been suggested that they were known
a huge flood. While the great king Yu (禹) was trying in pre-Islamic times.* [5] It is clear, however, that the
to channel the water out to sea, a turtle emerged from it study of magic squares was common in medieval Is-
with a curious figure / pattern on its shell: a 3×3 grid in lam in Persia, and it was thought to have begun after
which circular dots of numbers were arranged, such that the introduction of chess into the region.* [6] The 10th-
the sum of the numbers in each row, column and diago- century Persian mathematician Buzjani, for example, left
nal was the same: 15, which is also the number of days in a manuscript that on page 33 contains a series of magic
each of the 24 cycles of the Chinese solar year. Accord- squares, filled by numbers in arithmetic progression, in
ing to the legend, thereafter people were able to use this such a way that the sums of each row, column and diago-
pattern in a certain way to control the river and protect nal are equal.* [7]
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
1.3 Arabia
in which 1 is at the bottom and 2 is in the upper right cor-
Magic squares were known to Islamic mathematicians in
ner. Every normal magic square of order three is obtained
Arabia as early as the seventh century. They may have
from the Lo Shu by rotation or reflection.
learned about them when the Arabs came into contact
The Square of Lo Shu is also referred to as the Magic with Indian culture and learned Indian astronomy and
Square of Saturn. mathematics – including other aspects of combinatorial
mathematics. Alternatively, the idea may have come to
them from China. The first magic squares of order 5 and
1.2 Persia 6 known to have been devised by Arab mathematicians
appear in an encyclopedia from Baghdad circa 983, the
Rasa'il Ikhwan al-Safa (the Encyclopedia of the Brethren
of Purity); simpler magic squares were known to several
earlier Arab mathematicians.* [3]
The Arab mathematician Ahmad al-Buni, who worked
on magic squares around 1250, attributed mystical prop-
erties to them, although no details of these supposed prop-
erties are known. There are also references to the use of
magic squares in astrological calculations, a practice that
seems to have originated with the Arabs.* [3]
1.4 India
The Kubera-Kolam, a magic square of order three, is 15th century in the Library of Columbia University.* [12]
commonly painted on floors in India. It is essentially the It is interesting to observe that Paolo Dagomari, like Pa-
same as the Lo Shu Square, but with 19 added to each cioli after him, refers to the squares as a useful basis for
number, giving a magic constant of 72. 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
1.5 Europe Moon's squares, and mentions that they enter astrologi-
cal calculations that are not better specified. As said, the
same point of view seems to motivate the fellow Floren-
tine Luca Pacioli, who describes 3×3 to 9×9 squares in his
work De Viribus Quantitatis.* [13] Pacioli states: A las-
tronomia 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 as Ptolemy, Albumasar,
Alfraganus, Jabir and all the others, have shown that the
force and the virtue of numbers are necessary to that sci-
ence) and then goes on to describe the seven planetary
squares, with no mention of magical applications.
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.* [14] The text of the Liber de Angelis is
very close to that of De septem quadraturis planetarum
seu quadrati magici, another handbook of planetary im-
age magic contained in the Codex 793 of the Biblioteka
Jagiellońska (Ms BJ 793).* [15] The magical operations
involve engraving the appropriate square on a plate made
with the metal assigned to the corresponding planet,* [16]
This page from Athanasius Kircher's Oedipus Aegyptiacus as well as performing a variety of rituals. For instance, the
(1653) belongs to a treatise on magic squares and shows the Sig- 3×3 square, that belongs to Saturn, has to be inscribed on
illum Iovis associated with Jupiter a lead plate. It will, in particular, help women during a
difficult childbirth.
In 1300, building on the work of the Arab Al-Buni, Greek In 1514 Albrecht Dürer immortalizes a 4×4 square in his
Byzantine scholar Manuel Moschopoulos wrote a mathe- famous engraving “Melancholia I”.
matical treatise on the subject of magic squares, leaving
out the mysticism of his predecessors.* [9] Moschopoulos In about 1510 Heinrich Cornelius Agrippa wrote De Oc-
was essentially unknown to the Latin west. He was not, ei- culta Philosophia, drawing on the Hermetic and magical
ther, the first Westerner to have written on magic squares. works of Marsilio Ficino and Pico della Mirandola. In its
They appear in a Spanish manuscript written in the 1280s, 1531 edition, he expounded on the magical virtues of the
presently in the Biblioteca Vaticana (cod. Reg. Lat. seven magical squares of orders 3 to 9, each associated
1283a) due to Alfonso X of Castille.* [10] In that text, with one of the astrological planets, much in the same
each magic square is assigned to the respective planet, way as the older texts did. This book was very influen-
as in the Islamic literature.* [11] Magic squares surface tial throughout Europe until the counter-reformation, and
again in Italy in the 14th century, and specifically in Flo- Agrippa's magic squares, sometimes called kameas, con-
rence. In fact, a 6×6 and a 9×9 square are exhibited in a tinue to be used within modern ceremonial * *
magic in much
manuscript of the Trattato d'Abbaco (Treatise of the Aba- the same way as he first prescribed. [3] [17]
cus) by Paolo dell'Abbaco, aka Paolo Dagomari, a math- The most common use for these kameas is to provide a
ematician, astronomer and astrologer who was, among pattern upon which to construct the sigils of spirits, angels
other things, in close contact with Jacopo Alighieri, a or demons; the letters of the entity's name are converted
son of Dante. The squares can be seen on folios 20 into numbers, and lines are traced through the pattern
and 21 of MS. 2433, at the Biblioteca Universitaria of that these successive numbers make on the kamea. In a
Bologna. They also appear on folio 69rv of Plimpton 167, magical context, the term magic square is also applied
a manuscript copy of the Trattato dell'Abbaco from the
4 1 HISTORY
224716 4110 35 4 nals, each of the quadrants, the center four squares, and
the corner squares(of the 4×4 as well as the four con-
5 234817 421129 tained 3×3 grids). This sum can also be found in the four
30 6 2449183612 outer numbers clockwise from the corners (3+8+14+9)
13 31 7 254319 37 and likewise the four counter-clockwise (the locations
3814 32 1 264420 of four queens in the two solutions of the 4 queens
puzzle* [19]), the two sets of four symmetrical numbers
2139 8 33 2 2745 (2+8+9+15 and 3+5+12+14), the sum of the middle two
4615 40 9 34 3 28 entries of the two outer columns and rows (5+9+8+12
Hagiel = = 5; 3; 10; 1(10); 30(3) 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 derivation of the sigil of Hagiel, the planetary intelligence of The two numbers in the middle of the bottom row give
Venus, drawn on the magic square of Venus. Each Hebrew letter the date of the engraving: 1514. The numbers 1 and 4
provides a numerical value, giving the vertices of the sigil. at either side of the date correspond to the letters 'A' and
'D' which are the initials of the artist.
to a variety of word squares or number squares found Dürer's magic square can also be extended to a magic
in magical grimoires, including some that do not follow cube.* [20]
any obvious pattern, and even those with differing num- Dürer's magic square and his Melencolia I both also
bers of rows and columns. They are generally intended played large roles in Dan Brown's 2009 novel, The Lost
for use as talismans. For instance the following squares Symbol.
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;* [18] and two squares from The Book of the Sa- 1.7 Sagrada Família magic square
cred 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:
12 First generate a “truth”table, where a '1' indicates 2.5 Construction of panmagic squares
selecting from the square where the numbers are written
in order 1 to n2 (left-to-right, top-to-bottom), and a '0' Any number p in the order-n square can be uniquely writ-
indicates selecting from the square where the numbers are ten in the form p = an + r, with r chosen from {1,...,n}.
written in reverse order n2 to 1. For M = 4, the “truth” Note that due to this restriction, a and r are not the usual
table is as shown below, (third matrix from left.) quotient and remainder of dividing p by n. Consequently
Note that a) there are equal number of '1's and '0's; b) the problem of constructing can be split in two problems
each row and each column are“palindromic"; c) the left- easier to solve. So, construct two matching square grids
and right-halves are mirror images; and d) the top- and of order n satisfying panmagic properties, one for the a-
bottom-halves are mirror images (c & d imply b.) The numbers (0,..., n−1), and one for the r-numbers (1,...,n).
truth table can be denoted as (9, 6, 6, 9) for simplicity (1- This requires a lot of puzzling, but can be done. When
nibble per row, 4 rows.) Similarly, for M=8, two choices successful, combine them into one panmagic square. Van
for the truth table are (A5, 5A, A5, 5A, 5A, A5, 5A, A5) den Essen and many others supposed this was also the way
or (99, 66, 66, 99, 99, 66, 66, 99) (2-nibbles per row, 8 Benjamin Franklin (1706–1790) constructed his famous
rows.) For M=12, the truth table (E07, E07, E07, 1F8, Franklin squares. Three panmagic squares are shown be-
1F8, 1F8, 1F8, 1F8, 1F8, E07, E07, E07) yields a magic low. The first two squares have been constructed April
square (3-nibbles per row, 12 rows.) It is possible to count 2007 by Barink, the third one is some years older, and
the number of choices one has based on the truth table, comes from Donald Morris, who used, as he supposes,
taking rotational symmetries into account. the Franklin way of construction.
The order 8 square satisfies all panmagic properties, in-
cluding the Franklin ones. It consists of 4 perfectly pan-
2.4 Medjig-method of constructing magic magic 4×4 units. Note that both order 12 squares show
squares of even number of rows the property that any row or column can be divided in
three parts having a sum of 290 (= 1/3 of the total sum
This method is based on a 2006 published mathemat- of a row or column). This property compensates the ab-
ical game called medjig (author: Willem Barink, edi- sence of the more standard panmagic Franklin property
tor: Philos-Spiele). The pieces of the medjig puzzle are that any 1/2 row or column shows the sum of 1/2 of the
squares divided in four quadrants on which the numbers total. For the rest the order 12 squares differ a lot. The
0, 1, 2 and 3 are dotted in all sequences. There are 18 Barink 12×12 square is composed of 9 perfectly pan-
squares, with each sequence occurring 3 times. The aim magic 4×4 units, moreover any 4 consecutive numbers
of the puzzle is to take 9 squares out of the collection and starting on any odd place in a row or column show a sum
arrange them in a 3 × 3 “medjig-square”in such a way of 290. The Morris 12×12 square lacks these properties,
that each row and column formed by the quadrants sums but on the contrary shows constant Franklin diagonals.
to 9, along with the two long diagonals. For a better understanding of the constructing decompose
the squares as described above, and see how it was done.
The medjig method of constructing a magic square of or-
And note the difference between the Barink constructions
der 6 is as follows:
on the one hand, and the Morris/Franklin construction on
the other hand.
• Construct any 3 × 3 medjig-square (ignoring the In the book Mathematics in the Time-Life Science Li-
original game's limit on the number of times that brary Series, magic squares by Euler and Franklin are
a given sequence is used). shown. Franklin designed this one so that any four-square
subset (any four contiguous squares that form a larger
• Take the 3 × 3 magic square and divide each of its square, or any four squares equidistant from the center)
squares into four quadrants. total 130. In Euler's square, the rows and columns each
total 260, and halfway they total 130 – and a chess knight,
• Fill these quadrants with the four numbers from 1
making its L-shaped moves on the square, can touch all
to 36 that equal the original number modulo 9, i.e.
64 boxes in consecutive numerical order.
x+9y where x is the original number and y is a num-
ber from 0 to 3, following the pattern of the medjig-
square.
2.6 Construction similar to the Kronecker
Example: Product
Similarly, for any larger integer N, a magic square of or-
der 2N can be constructed from any N × N medjig-square There is a method reminiscent of the Kronecker prod-
with each row, column, and long diagonal summing to uct of two matrices, that builds an nm × nm magic
3N, and any N × N magic square (using the four numbers square from an n × n magic square and an m × m magic
from 1 to 4N 2 that equal the original number modulo N 2 ). square.* [26]
3.4 Multiplicative magic squares of complex numbers 7
2.7 The construction of a magic square us- 3.4 Multiplicative magic squares of com-
ing genetic algorithms plex numbers
A magic square can be constructed using genetic al- Still using Ali Skalli's non iterative method, it is possible
gorithms.* [27] In this process an initial population of to produce an infinity of multiplicative magic squares of
squares with random values is generated. The fitness complex numbers* [29] belonging to C set. On the ex-
scores of these individual squares are calculated based on ample below, the real and imaginary parts are integer
the degree of deviation in the sums of the rows, columns, numbers, but they can also belong to the entire set of
and diagonals. The population of squares reproduce by real numbers R . The product is: −352,507,340,640 −
exchanging values, together with some random muta- 400,599,719,520 i.
tions. Those squares with a higher fitness score are more
likely to reproduce. The fitness scores of the next gen-
eration squares are calculated, and this process continues 3.5 Other magic shapes
until a magic square is found or a time limit is reached.
Other shapes than squares can be considered. The gen-
eral 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
3 Generalizations sum. Examples include magic dodecahedrons, magic tri-
angles* [30] magic stars, and magic hexagons. Going up
3.1 Extra constraints in dimension results in magic cubes and other magic hy-
percubes.
Certain extra restrictions can be imposed on magic Edward Shineman has developed yet another design in the
squares. If not only the main diagonals but also the shape of magic diamonds.
broken diagonals sum to the magic constant, the result Possible magic shapes are constrained by the number of
is a panmagic square. equal-sized, equal-sum subsets of the chosen set of la-
If raising each number to the nth power yields another bels. For example, if one proposes to form a magic shape
magic square, the result is a bimagic (n = 2), a trimagic labeling the parts with {1, 2, 3, 4}, the sub-designs will
(n = 3), or, in general, a multimagic square. have to be labeled with {1,4} and {2,3}.* [30]
A magic square in which the number of letters in the
name of each number in the square generates another 3.6 Other component elements
magic square is called an alphamagic square.
4 Related problems
Over the years, many mathematicians, including Euler,
Cayley and Benjamin Franklin have worked on magic
squares, and discovered fascinating relations.