Magic square

From Wikipedia, the free encyclopedia

In recreational mathematics, a magic square of order n is an arrangement of n² numbers, usually distinct integers, in a square, such that the n numbers in all rows, all columns, and both diagonals sum to the same constant. A normal magic square contains the integers from 1 to n². The term "magic square" is also sometimes used to refer to any of various types of word square.

Normal magic squares exist for all orders n ≥ 1 except n = 2, although the case n = 1 is trivial—it consists of a single cell containing the number 1. The smallest nontrivial case, shown below, is of order 3.

Image:Magicsquareexample.svg

The constant sum in every row, column and diagonal is called the magic constant or magic sum, M. The magic constant of a normal magic square depends only on n and has the value

M(n) = \frac{n^3+n}{2}

For normal magic squares of order n = 3, 4, 5, …, the magic constants are:

15, 34, 65, 111, 175, 260, … (sequence A006003 in OEIS)
Unsolved problems in mathematics: How many nxn magic squares for n>5?

Contents

[edit] Brief history of magic squares

[edit] The Lo Shu square (3×3 magic square)

Chinese literature dating from as early as 2800 BC tells the legend of Lo Shu or "scroll of the river Lo". In ancient China, there was a huge flood. The people tried to offer some sacrifice to the river god of one of the flooding rivers, the Lo river, to calm his anger. Then, there emerged from the water a turtle with a curious figure/pattern on its shell; there were circular dots of numbers that were arranged in a three by three nine-grid pattern such that the sum of the numbers in each row, column and diagonal was the same: 15. This number is also equal to the number of days in each of the 24 cycles of the Chinese solar year. This pattern, in a certain way, was used by the people in controlling the river.

4 9 2
3 5 7
8 1 6

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.

The Square of Lo Shu is also referred to as the Magic Square of Saturn or Cronos. Its numerical value is obtained from the workings of the I Ching when the Trigrams are placed in an order given in the first river map, the Ho Tu or Yellow River. The Ho Tu produces 4 squares of Hexagrams 8 x 8 in its outer values of 1 to 6, 2 to 7, 3 to 8, and 4 to 9, and these outer squares can then be symmetrically added together to give an inner central square of 5 to 10. The central values of the Ho Tu are those of the Lo Shu (so they work together), since in the total value of 15 x 2 (light and dark) is found the number of years in the cycle of equinoctial precession (12,960 x 2 = 25,920). The Ho Tu produces a total of 40 light and 40 dark numbers called the days and nights (the alternations of light and dark), and a total of 8 x 8 x 8 Hexagrams whose opposite symmetrical addition equals 8640, therefore each value of a square is called a season as it equals 2160. 8640 is the number of hours in a 360-day year, and 2160 years equals an aeon (12 aeons = 25,920 yrs).

To validate the values contained in the 2 river maps (Ho Tu and Lo Shu) the I Ching provides numbers of Heaven and Earth that are the 'Original Trigrams' (father and mother) from 1 to 10. Heaven or a Trigram with all unbroken lines (light lines - yang) have odd numbers 1,3,5,7,9, and Earth a Trigram with all broken lines have even numbers 2,4,6,8,10. If each of the Trigram's lines is given a value by multiplying the numbers of Heaven and Earth, then the value of each line in Heaven 1 would be 1 + 2 + 3 = 6, and its partner in the Ho Tu of Earth 6 would be 6 + 12 + 18 = 36, these 2 'Original Trigrams' thereby produce 6 more Trigrams (or children in all their combinations) -- and when the sequences of Trigrams are placed at right angles to each other they produce an 8 x 8 square of Hexagrams (or cubes) that each have 6 lines of values. From this simple point the complex structure of the maths evolves as a hexadecimal progression, and it is the hexagon that is the link to the turtle or tortoise shell. In Chinese texts of the I Ching the moon is symbolic of water (darkness) whose transformations or changes create the light or fire - the dark value 6 creates the light when its number is increased by 1. This same princple can be found in ancient calendars such as the Egyptian, as the 360 day year of 8640 hrs was divided by 72 to produce the 5 extra days or 120 hours on which the gods were born. It takes 72 years for the heavens to move 1 degree through its Precession.

[edit] The early squares of order four (4x4 magic squares)

The earliest magic square of order four was found in an inscription in Khajuraho, India and in the Encyclopedia of the Brethren of Purity,Arabic رسائل اخوان الصفا dating from the eleventh or twelfth century; it is also a panmagic square where, in addition to the rows, columns and main diagonals, the broken diagonals also have the same sum.

Yang Hui was one of the first mathematicians to study magic squares, or vertical and horizontal diagrams as they were called. He created several magic squares, including 4th order ones.

[edit] Cultural significance of magic squares

Magic squares have fascinated humanity throughout the ages, and have been around for over 4,000 years. They are found in a number of cultures, including Egypt and India, engraved on stone or metal and worn as talismans, the belief being that magic squares had astrological and divinatory qualities, their usage ensuring longevity and prevention of diseases.

The Kubera-Kolam is a floor painting used in India which is in the form of a magic square of order three. It is essentially the same as the Lo Shu Square, but with 19 added to each number, giving a magic constant of 72.

23 28 21
22 24 26
27 20 25

[edit] Islam

Magic squares were known to Arab mathematicians possibly from the 7th century, when the Arabs conquered parts of India and absorbed a lot of mathematics and astronomy, including other aspects of combinatorial mathematics. It has also been suggested that the idea came via China. The first magic squares of order 5 and 6 appear in an encyclopedia from Baghdad c. 983 AD, Rasa'il Ihkwan al-Safa (the Encyclopedia of the Brethern of Purity), and several earlier Arab mathematicians had known of simpler magic squares.[1]

The Arab mathematician Al-Buni, who worked on magic squares in around 1200, attributed them with mystical properties, although no details of these supposed properties are now known. There are also references to the use of magic squares in astrological calculations, a practice that seems to have originated with the Arabs.[1]

[edit] Europe

In 1300, building on the work of the Arab Al-Buni, Greek Byzantine scholar Manuel Moschopoulos wrote a mathematical treatise on the subject of magic squares, leaving out the mysticism of his predecessors.[2] Moschopoulos is thought to be the first Westerner to have written on the subject. In the 1450s the Italian Luca Pacioli studied magic squares and collected a large number of examples.[1]

In about 1510 Heinrich Cornelius Agrippa wrote De Occulta Philosophia, drawing on the Hermetic and magical works of Marsilio Ficino and Pico della Mirandola, and in it he expounded on the magical virtues of seven magical squares of orders 3 to 9, each associated with one of the astrological planets. 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.[1][3]

Saturn=15
4 9 2
3 5 7
8 1 6
Jupiter=34
4 14 15 1
9 7 6 12
5 11 10 8
16 2 3 13
Mars=65
11 24 7 20 3
4 12 25 8 16
17 5 13 21 9
10 18 1 14 22
23 6 19 2 15
Sol=111
6 32 3 34 35 1
7 11 27 28 8 30
19 14 16 15 23 24
18 20 22 21 17 13
25 29 10 9 26 12
36 5 33 4 2 31
Venus=175
22 47 16 41 10 35 4
5 23 48 17 42 11 29
30 6 24 49 18 36 12
13 31 7 25 43 19 37
38 14 32 1 26 44 20
21 39 8 33 2 27 45
46 15 40 9 34 3 28
Mercury=260
8 58 59 5 4 62 63 1
49 15 14 52 53 11 10 56
41 23 22 44 45 19 18 48
32 34 35 29 28 38 39 25
40 26 27 37 36 30 31 33
17 47 46 20 21 43 42 24
9 55 54 12 13 51 50 16
64 2 3 61 60 6 7 57
Luna=369
37 78 29 70 21 62 13 54 5
6 38 79 30 71 22 63 14 46
47 7 39 80 31 72 23 55 15
16 48 8 40 81 32 64 24 56
57 17 49 9 41 73 33 65 25
26 58 18 50 1 42 74 34 66
67 27 59 10 51 2 43 75 35
36 68 19 60 11 52 3 44 76
77 28 69 20 61 12 53 4 45
The derivation of the 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 derivation of the 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;[4] 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:

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
6 66 848 938
8 11 544 839
1 11 383 839
2 73 774 447
H E S E B
E Q A L
S
E G
B
A D A M
D A R A
A R A D
M A D A
H O M O

[edit] Albrecht Dürer's magic square

Detail of Melancholia I
Detail of Melancholia I

The order-4 magic square in Albrecht Dürer's engraving Melancholia I is believed to be the first seen in European art. It is very similar to Yang Hui's square, which was created in China about 250 years before Dürer's time. The sum 34 can be found in the rows, columns, diagonals, each of the quadrants, the center four squares, the corner squares, 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 8 queens puzzle [1]), the two sets of four symmetrical numbers (2+8+9+15 and 3+5+12+14) and the sum of the middle two entries of the two outer columns and rows (e.g. 5+9+8+12), as well as several kite-shaped quartets, e.g. 3+5+11+15; the two numbers in the middle of the bottom row give the date of the engraving: 1514.

16 3 2 13
5 10 11 8
9 6 7 12
4 15 14 1

[edit] The Sagrada Família magic square

A magic square on the Sagrada Família church façade.
A magic square on the Sagrada Família church façade.

The Passion façade of the Sagrada Família church in Barcelona, designed by sculptor Josep Subirachs, features a 4×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.

1 14 14 4
11 7 6 9
8 10 10 5
13 2 3 15

While having the same pattern of summation, this is not a normal magic square as above, as two numbers (10 and 14) are duplicated and two (12 and 16) are absent, failing the 1→n² rule.

[edit] Types of magic squares and their construction

There are many ways to construct magic squares, but the standard (and most simple) way is to follow certain configurations/formulas which generate regular patterns. Magic squares exist for all values of n, with only one exception - it is impossible to construct a magic square of order 2. Magic squares can be classified into three types: odd, doubly even (n divisible by four) and singly even (n even, but not divisible by four). Odd and doubly even magic squares are easy to generate; the construction of singly even magic squares is more difficult but several methods exist, including the LUX method for magic squares (due to John Horton Conway) and the Strachey method for magic squares.

Group theory was also used for constructing new magic squares of a given order from one of them, please see [2].


[edit] A method for constructing a magic square of odd order

Starting from the central column of the first row with the number 1, the fundamental movement for filling the squares is diagonally up and right, one step at a time. If a filled square is encountered, one moves vertically down one square instead, then continuing as before. When a move would leave the square, it is wrapped around to the last row or first column, respectively.

Similar patterns can also be obtained by starting from other squares.

Order 3
8 1 6
3 5 7
4 9 2
Order 5
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9
Order 9
47 58 69 80 1 12 23 34 45
57 68 79 9 11 22 33 44 46
67 78 8 10 21 32 43 54 56
77 7 18 20 31 42 53 55 66
6 17 19 30 41 52 63 65 76
16 27 29 40 51 62 64 75 5
26 28 39 50 61 72 74 4 15
36 38 49 60 71 73 3 14 25
37 48 59 70 81 2 13 24 35



The following formulae help construct magic squares of odd order


Order 5
Squares (n) Last No. Middle No. * Sum (M)*
n n2 \frac{n^2}{2}+ 0,5 \left(\frac{n^2}{2}+ 0,5 \right) n

* Square roots are easier to calculate then cubic roots


Example:

Order 5
Squares (n) Last No. Middle No. Sum (M)
5 25 13 65


The "Middle Number" is always in the diagonal bottom left to top right.
The "Last Number" is always opposite the number 1 in an outside column or row.



[edit] A method of constructing a magic square of doubly even order

Doubly even means that n is an even multiple of an even integer; or 4p, where p is an integer. eg 4, 8, 12

Generic pattern

All the numbers are written in order from right to left across each row in turn, starting from the top left hand corner. Numbers are then either retained in the same place or interchanged with their diametrically opposite numbers in a certain regular pattern. In the magic square of order four, the numbers in the four central squares and one square at each corner are retained in the same place and the others are interchanged with their diametrically opposite numbers.

A construction of a magic square of order 4

Go left to right through the square filling counting and filling in on the diagonals only. Then continue by going left to right from the top left of the table and fill in counting down from 16 or n². As shown below.

M = Order 4
1 4
6 7
10 11
13 16
M = Order 4
1 15 14 4
12 6 7 9
8 10 11 5
13 3 2 16

[edit] The medjig-method of constructing magic squares of even order n>4

This playful method is based on a 2006 published mathematical game called "medjig" (author: Willem Barink, editor: Philos-Spiele). The pieces of the medjig puzzle are squares divided in four quadrants on which the numbers 0, 1, 2 and 3 are dotted in all sequences. There are 18 squares, every sequence occurs 3 times. The aim of the puzzle is to take 9 squares out of the collection and arrange them in a 3 x 3 "medjig-square" in such a way that the series, columns and diagonals formed by the quadrants, show the sum of 9.

The medjig way of construction of a magic square of order 6 goes as follows. Arrange a 3 x 3 medjig square (for convenience this time you may choose unlimited from the whole collection). Then take the well-known classic 3 x 3 magic square and divide all fields of it in four quadrants. Next fill these quadrants with the original number and its three modulo-9 numbers up to 36, following the pattern of the medjig-solution. Doing so, the original field with the number 8 yields the four subfields with the numbers 8 (= 8 + 0x9), 17 (= 8 + 1x9), 26 (= 8 + 2x9) and 35 (= 8 + 3x9), the field with the number 3 yields the numbers 3, 12, 21 and 30, etc… See illustration below.

Order 3
8 1 6
3 5 7
4 9 2
Medjig 3 x 3
2 3 0 2 0 2
1 0 3 1 3 1
3 1 1 2 2 0
0 2 0 3 3 1
3 2 2 0 0 2
0 1 3 1 1 3
Order 6
26 35 1 19 6 24
17 8 28 10 33 15
30 12 14 23 25 7
3 21 5 32 34 16
31 22 27 9 2 20
4 13 36 18 11 29

The same way you can construct a magic square of order 8. You first have to construct a 4 x 4 medjig solution (sum of all series, columns and diagonals 12). And then enlarge e.g. the well-known Dürer 4 x 4 magic square modulo-16 to 64. For the construction of a magic square of order 10 you have to arrange a 5 x 5 medjig solution, for which two sets of medjig pieces are needed. For the order 12 you can simply duplicate horizontally and vertically a 3 x 3 medjig solution and then enlarge modulo-36 to 144 the order 6 magic square made above. Order 16 goes the same way.

[edit] Generalizations

[edit] Extra constraints

Certain extra restrictions can be imposed on magic squares. If not only the main diagonals but also the broken diagonals sum to the magic constant, the result is a panmagic square. If raising each number to certain powers yields another magic square, the result is a bimagic, a trimagic, or, in general, a multimagic square.

[edit] Different constraints

Sometimes the rules for magic squares are relaxed, so that only the rows and columns but not necessarily the diagonals sum to the magic constant. In heterosquares and antimagic squares, the 2n + 2 sums must all be different.

[edit] Other operations

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.

M = 216
2 9 12
36 6 1
3 4 18
M = 6720
1 6 20 56
40 28 2 3
14 5 24 4
12 8 7 10

[edit] Other magic shapes

Other shapes than squares can be considered, resulting, for example, in magic stars and magic hexagons. Going up in dimension results in magic cubes, magic tesseracts and other magic hypercubes.

[edit] Combined extensions

One can combine two or more of the above extensions, resulting in such objects as multiplicative multimagic hypercubes. Little seems to be known about this subject.

[edit] Related problems

Over the years, many mathematicians, including Euler and Cayley have worked on magic squares, and discovered fascinating relations.

[edit] Magic square of primes

Rudolf Ondrejka (1928-2001) discovered the following 3x3 magic square of primes, in this case nine Chen primes:

17 89 71
113 59 5
47 29 101

The Green-Tao theorem implies that there are arbitrarily large magic squares consisting of primes.

[edit] 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.

[edit] See also

[edit] References

  1. ^ a b c d Swaney, Mark History of Magic Squares
  2. ^ Manuel Moschopoulos - Mathematics and the Liberal Arts
  3. ^ Drury, Nevill (1992). Dictionary of Mysticism and the Esoteric Traditions. Bridport, Dorset: Prism Press. ISBN 1-85327-075-X. 
  4. ^ "The Book of Power: Cabbalistic Secrets of Master Aptolcater, Mage of Adrianople", transl. 1724. In Shah, Idries (1957). The Secret Lore of Magic. London: Frederick Muller Ltd. 
Wikisource has an original article from the 1911 Encyclopædia Britannica about:
  • W. S. Andrews, Magic Squares and Cubes. (New York: Dover, 1960), originally printed in 1917
  • 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 ( pdf )
  • Mark Farrar, Magic Squares ( [3] )