Magic square

From Free net 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².

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.

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

<math>M(n) = \frac{n^3+n}{2}</math>

The middle number can be found by

<math> = \frac{n^2+1}{2}</math>

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

15, 34, 65, 111, 175, 260, …

(sequence A006003 in OEIS)

Contents

Brief history of magic squares

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.

Image:MagicSquare-LoShu.png

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 Cronus, which thereby denotes it is the square of time. 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), as in the total value of 15 x 2 (light and dark) is found the exact number of years in the cycle of Equinoxal 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 = 8640, therefore each value of a square is called a season as it = 2160. These are the exact amount of hours in a Lunar Year (8640), and also 2160 years = 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 each sequence 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. The working of the maps and squares firstly provide the Lunar Year as x 6, and as Hexagrams we find all values as x 7, which is Solar. The moon is symbolic of water (darkness) through whose transformation light or fire rises up out of the waters - dark thereby creates the light when its number is increased by 1. This same princple can be found at work in ancient calendars such as the Egyptian, as the Lunar Year of 8640 hrs was divided by a 7th or 72 part to produce the 5 extra days or 120 hours on which the gods were born. 72 is the number or key as it takes 72 year for the heavens to move 1 degree through its Precession.

The early squares of order four (4x4 magic squares)

The earliest magic square of order four was found in an inscription in Khajuraho, India, 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. [1]

Cultural significance of magic squares

Magic Squares have fascinated humanity throughout the ages, and have been around for over 4,000 years. They were frequently 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.

Image:MagicSquare-KuberaKolam.png

The magic square figures in Greek writings dating from about 1300 BC were used by Arab astrologers in the ninth century when drawing up horoscopes. Modern occultism links the first 7 magic squares to the 7 traditional astrological planets, as opposed to the astronomical planets of Earth's solar system.

Albrecht Dürer's magic square

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 times. 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 4 queens puzzle [2]), 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.

Image:MagicSquare-AlbrechtDürer.png

The Sagrada Família magic square

Image:Ms sf 2.jpg

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 sum 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.

Image:MagicSquare-JosepSubirachs.png

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. Only odd and doubly even magic squares are discussed below.

A method for constructing a magic square of odd order

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

The same pattern can be achieved starting from the central column of the first row; In this case the fundamental movement is diagonally up and right, one step at a time, and 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 the last row or first column, respectively.

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

Image:MagicSquare-Order3.png Image:MagicSquare-Order5.png Image:MagicSquare-Order9.png
Order 3 Order 5 Order 9

A method of constructing a magic square of doubly even order

All the numbers are written in order from right to left across each row in turn, starting from the top right 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. In the magic square of order eight, the same is done; the 16 central squares and 4 squares at each corner are retained in their places and the rest are switched.

A general rule: If n represents the order of the doubly even square, retain numbers in the following pattern. The central square with sides of length n/2 should be retained. Also retain the squares with sides of length n/4 in each of the four corners.

Image:MagicSquare-Order8.png
Order 8

Counting magic squares

Counting the number of distinct normal magic squares is a difficult problem in combinatorics. Squares that differ trivially by a rotation or a reflection are considered equivalent and are counted just as one, see Frénicle standard form. Even so, the count increases rapidly with n. In fact, non-trivial exact results are known only for n = 4 and n = 5. The magic square count is sequence A006052 in OEIS.

Order Count Details
3 1 The Lo Shu Square
4 880 Frénicle de Bessy (1693) [3]
5 275305224 Richard Schroeppel (1973)
6 (1.7754 ± 0.0016) × 1019 Klaus Pinn and C. Wieczerkowski (1998),
through Monte Carlo simulation.
7 (3.7982 ± 0.0004) × 1034

Generalizations

Extra constraints

Certain extra restrictions can be imposed on magical 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.

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.

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.

Image:MultiplicativeMagicSquare-Order3.png Image:MultiplicativeMagicSquare-Order4.png
M = 216 M = 6720

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.

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.

Related problems

Magic Square of Primes

Rudolf Ondrejka discovered the following 3x3 magic square of primes, in this case nine Chen primes:

178971
113595
4729101

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.

See also

External links

References

  • 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)Template:Link FA

de:Magisches Quadrat es:Cuadrado mágico eo:Magia kvadrato fa:مربع وفقی fr:Carré magique (mathématiques) ko:마방진 io:Magiala quadrato it:Quadrato magico he:ריבוע קסם nl:Magisch vierkant ja:魔方陣 pl:Kwadrat magiczny (matematyka) pt:Quadrado mágico ro:Pătrat magic ru:Магический квадрат sl:Magični kvadrat sv:Magisk kvadrat th:จัตุรัสกล zh:幻方