All Topics  
Magic square

 

   Email Print
   Bookmark   Link






 

Magic square



 
 
In recreational mathematics
Recreational mathematics

Recreational mathematics is an umbrella term, referring to mathematical puzzles and mathematical games.Not all problems in this field require a knowledge of advanced mathematics, and thus, recreational mathematics often piques the curiosity of non-mathematicians, and inspires their further study of mathematics....
, a magic square of order n is an arrangement of n² numbers, usually distinct integer
Integer

The integers are natural numbers including 0 and their negative and non-negative numberss . They are numbers that can be written without a fractional or decimal component, and fall within the set ....
s, in a square
Square (geometry)

In Euclidean geometry, a square is a regular polygon with four equal sides and four equal angles . A square with vertices ABCD would be denoted ....
, 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
Word square

A word square is a special case of acrostic. It consists of a set of words, all having the same number of letters as the total number of words ; when the words are written out in a square grid horizontally, the same set of words can be read vertically....
.

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.






Discussion
Ask a question about 'Magic square'
Start a new discussion about 'Magic square'
Answer questions from other users
Full Discussion Forum



Recent Posts









Encyclopedia


In recreational mathematics
Recreational mathematics

Recreational mathematics is an umbrella term, referring to mathematical puzzles and mathematical games.Not all problems in this field require a knowledge of advanced mathematics, and thus, recreational mathematics often piques the curiosity of non-mathematicians, and inspires their further study of mathematics....
, a magic square of order n is an arrangement of n² numbers, usually distinct integer
Integer

The integers are natural numbers including 0 and their negative and non-negative numberss . They are numbers that can be written without a fractional or decimal component, and fall within the set ....
s, in a square
Square (geometry)

In Euclidean geometry, a square is a regular polygon with four equal sides and four equal angles . A square with vertices ABCD would be denoted ....
, 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
Word square

A word square is a special case of acrostic. It consists of a set of words, all having the same number of letters as the total number of words ; when the words are written out in a square grid horizontally, the same set of words can be read vertically....
.

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.
Magicsquareexample
The constant sum in every row, column and diagonal is called the magic constant
Magic constant

The magic constant or magic sum of a magic square is the sum of numbers in any row, column, and diagonal of the magic square. For example, the magic square shown below has a magic constant of 15....
 or magic sum, M. The magic constant of a normal magic square depends only on n and has the value

For normal magic squares of order n = 3, 4, 5, …, the magic constants are:
15, 34, 65, 111, 175, 260, … (sequence A006003 in OEIS
On-Line Encyclopedia of Integer Sequences

The On-Line Encyclopedia of Integer Sequences , also cited simply as Sloane's, is an extensive searchable database of integer sequences, freely available on the World Wide Web....
).


History of magic squares


The Lo Shu square (3×3 magic square)

Chinese literature
Chinese literature

Chinese literature extends back thousands of years, from the earliest recorded dynastic court archives to the mature fictional novel that arose during the Ming Dynasty to entertain the masses of literate Chinese....
 dating from as early as 650 BC tells the legend of Lo Shu or "scroll of the river Lo". In ancient China there was a huge flood. The great king
The Great King

The Great King is a 1942 in film drama film directed by Veit Harlan and starring Otto Geb?hr. ...
 Yu tried to channel the water out to sea where then emerged from the water a turtle
Turtle

Turtles are reptiles of the Order Testudines , most of whose body is shielded by a special bone or cartilage animal shell developed from their ribs....
 with a curious figure/pattern on its shell; circular dots of numbers which were arranged in a three by three grid pattern such that the sum of the numbers in each row, column and diagonal was the same: 15. Fifteen also being 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
Lo Shu Square

Lo Shu Square or the Nine Halls Diagram , is the unique normal magic square of order three. Lo Shu is part of the legacy of the most ancient Chinese mathematical and divinatory traditions, and is an important emblem in Feng Shui , the art of geomancy concerned with the placement of objects in relation to the flow of qi 'natural en...
, 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
Saturn

Saturn is the sixth planet from the Sun and the second largest planet in the Solar System, after Jupiter. Saturn, along with Jupiter, Uranus and Neptune, is classified as a gas giant....
 or Cronos. Its numerical value is obtained from the workings of the I Ching
I Ching

The I Ching , or ?Y? Jing? ; also called Classic of Changes or Book of Changes is one of the oldest of the Chinese classic texts....
 when the Trigram
Trigram

Trigrams are a special case of the N-gram, where N is 3. They are often used in natural language processing for doing statistical analysis of texts....
s are placed in an order given in the first river map, the Ho Tu or Yellow River
Yellow River

The Yellow River or Huang He / Hwang Ho is the second-longest river in China and the List of rivers by length in the world at 4,845 kilometers ....
. The Ho Tu produces 4 squares of Hexagram
Hexagram

A hexagram is a six-pointed geometric star figure, or 2, the compound of two equilateral triangle s. The intersection is a regular hexagon.While generally recognized as a symbol of Jewish identity it is used also in other historical, religious and cultural contexts, for example in #Use of the Star by Arabs and Muslims, and #Occurrence in...
s 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
Aeon

The word aeon, also spelled eon or ?on, means "age", "forever" or "for eternity". It is a Latin transliteration from the koine Greek word , from the archaic ....
 (12 aeons = 25,920 yrs).

To validate the values contained in the 2 river maps (Ho Tu and Lo Shu) the I Ching
I Ching

The I Ching , or ?Y? Jing? ; also called Classic of Changes or Book of Changes is one of the oldest of the Chinese classic texts....
 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
Yin and yang

In Chinese philosophy, the concept of yin yang is used to describe how seemingly disjunct or opposing forces are interconnected and interdependent in the natural world, giving rise to each other in turn....
) 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 principle can be found in ancient calendars such as the Egyptian
Egyptian calendar

The ancient civil Egyptian calendar had a year that was 365 days long and was divided into 12 months of 30 days each, plus 5 extra days at the end of the year....
, where 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.

Cultural significance of magic squares

Magic squares have fascinated humanity throughout the ages, and have been around for over 4,120 years. They are found in a number of cultures, including Egypt
Egypt

Egypt is a country mainly in North Africa, with the Sinai Peninsula forming a land bridge in Western Asia. Covering an area of about , Egypt borders the Mediterranean Sea to the north, the Gaza Strip and Israel to the northeast, the Red Sea to the east, Sudan to the south and Libya to the west....
 and India, engraved on stone or metal and worn as talisman
Amulet

An amulet , a close cousin of the talisman consists of any object intended to bring good luck and/or protection to its owner.Potential amulets include: Gemstone or simple Gemstone, statues, coins, drawings, pendants, jewelry ring, plants, animals, etc.; even words said in certain occasions?for example: vade retro satana?, to repe...
s, the belief being that magic squares had astrological
Astrology

Astrology is a group of systems, traditions, and beliefs which hold that the relative positions of astronomical object and related details can provide useful information about personality, human affairs, and other terrestrial matters....
 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

Persia

Although a definitive judgement of early history of magic squares is not available, it has been suggested that magic squares are probably of pre-Islamic Persian origin. The study of magic squares in medieval Islam
Islamic Golden Age

The Islamic Golden Age, also sometimes known as the Islamic Renaissance, was traditionally dated from the 700 A.D. to 1200 A.D.Common Era, but has been extended to the 15th and 16th centuries by some scholars....
 in Persia is however common, and supposedly, came after the introduction of Chess
Chess

Chess is a recreational and competitive game played between two Player . Sometimes called Western chess or international chess to distinguish it from History of chess and other chess variants, the current form of the game emerged in Southern Europe during the second half of the 15th century after evolving from similar, much older...
 in Persia. For instance in the tenth century, the Persian mathematician Buzjani has left a manuscript on page 33 of which there is a magic squares, which are filled by numbers in arithmetic progression in such a way that the sums on each line, column and diagonal are equal.

Arabia

Magic squares were known to Islamic mathematics
Islamic mathematics

Mathematics in medieval Islam or sometimes referred to as Islamic mathematics is a term used in the history of mathematics that refers to the mathematics developed in the Muslim world between 622 and 1600, in the part of the world where Islam was the dominant religion....
, possibly as early as the 7th century, when the Arab
Arab

An Arab is a person who Identity as such on linguistic or cultural grounds. The plural form, Arabs , refers to the Ethnocultural group at large....
s got into contact with Indian and Persians or South Asian culture, and learned Indian 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
Baghdad

Baghdad is the Capital of Iraq and of Baghdad Governorate, with which it is also coterminous. With a municipal population estimated at 6.5 million, it is the largest city in Iraq, and the second largest city in the Arab World....
 circa 983 AD, the Rasa'il Ikhwan al-Safa (the Encyclopedia of the Brethern of Purity); simpler magic squares were known to several earlier Arab mathematicians.

The Arab mathematician Ahmad al-Buni, who worked on magic squares around 1250 A.D., attributed mystical properties to them, although no details of these supposed properties 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.

India


The 3x3 magic square was used as part of rituals in India from vedic times, and continues to be used till date. A well known early 4x4 magic square in India can be seen in Khajuraho
Khajuraho

Khajuraho is a village in the States and territories of India of Madhya Pradesh, located in Chhatarpur District, about 385 miles southeast of Delhi, the capital city of India....
 in the Parshvanath Jain temple. It dates from the 10th century .

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


This is referred to as the Chautisa Yantra, since each sub-square sums to 34.

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. Moschopoulos is thought to be the first Westerner to have written on the subject. In the 1450s the Italian Luca Pacioli
Luca Pacioli

Fra Luca Bartolomeo de Pacioli was an Italy mathematician and Franciscan friar, collaborator with Leonardo da Vinci, and seminal contributor to the field now known as accounting....
 studied magic squares and collected a large number of examples.

In about 1510 Heinrich Cornelius Agrippa
Heinrich Cornelius Agrippa

Heinrich Cornelius Agrippa von Nettesheim was a German magic , occult writer, theology, astrology, and alchemy....
 wrote De Occulta Philosophia, drawing on the Hermetic
Hermeticism

Hermeticism is a set of philosophy and Religion beliefs based primarily upon the Hellenistic Egyptian Pseudepigrapha attributed to Hermes Trismegistus who is the representation of the congruence of the Egyptian god Thoth and the Greek Hermes....
 and magical
Magic (paranormal)

Magic, sometimes known as sorcery, is a conceptual system that asserts human ability to control or predict the nature through Mysticism, paranormal or supernatural means....
 works of Marsilio Ficino
Marsilio Ficino

Marsilio Ficino was one of the most influential humanism philosophy of the early Italian Renaissance, an astrologer, a reviver of Neoplatonism who was in touch with every major academic thinker and writer of his day, and the first translator of Plato's complete extant works into Latin....
 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
Astrology

Astrology is a group of systems, traditions, and beliefs which hold that the relative positions of astronomical object and related details can provide useful information about personality, human affairs, and other terrestrial matters....
 planets. This book was very influential throughout Europe until the counter-reformation
Counter-Reformation

The Counter-Reformation denotes the period of Roman Catholic Church revival from the pontificate of Pope Pius IV in 1560 to the close of the Thirty Years' War, 1648....
, 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.




! colspan="3" | Saturn=15
|-
| 4 >
9 >-
| 3
5 >-
| 8
1 >}

! colspan="4" | Jupiter=34
|-
| 4
14 15 >-
| 9
7 6 >-
| 5
11 10 >-
| 16
2 3 >}

! colspan="5" | Mars=65
|-
| 11
24 7 20 >-
| 4
12 25 8 >-
| 17
5 13 21 >-
| 10
18 1 14 >-
| 23
6 19 2 >}

! colspan="6" | Sol
Sun (astrology)

The sun is considered a very important part of astrology. It, as well as the Moon , are the most important of the Planets in astrology. In Roman mythology the sun was represented by Apollo, the god of light and Helios the god of the sun....
=111
|-
| 6

32 3 34 35 >-
| 7
11 27 28 8 >-
| 19
14 16 15 23 >-
| 18
20 22 21 17 >-
| 25
29 10 9 26 >-
| 36
5 33 4 2 >}





! colspan="7" | Venus=175
|-
| 22
47 16 41 10 35 >-
| 5
23 48 17 42 11 >-
| 30
6 24 49 18 36 >-
| 13
31 7 25 43 19 >-
| 38
14 32 1 26 44 >-
| 21
39 8 33 2 27 >-
| 46
15 40 9 34 3 >}

! colspan="8" | Mercury=260
|-
| 8
58 59 5 4 62 63 >-
| 49
15 14 52 53 11 10 >-
| 41
23 22 44 45 19 18 >-
| 32
34 35 29 28 38 39 >-
| 40
26 27 37 36 30 31 >-
| 17
47 46 20 21 43 42 >-
| 9
55 54 12 13 51 50 >-
| 64
2 3 61 60 6 7 >}

! colspan="9" | Luna
Moon (astrology)

The Moon is the earth's companion satellite, though some astronomers believe that it approaches being a planet in its own right. The Moon is large enough for its gravity to affect the Earth, stabilising its orbit and producing the regular ebb and flow of the tides....
=369
|-
| 37

78 29 70 21 62 13 54 >-
| 6
38 79 30 71 22 63 14 >-
| 47
7 39 80 31 72 23 55 >-
| 16
48 8 40 81 32 64 24 >-
| 57
17 49 9 41 73 33 65 >-
| 26
58 18 50 1 42 74 34 >-
| 67
27 59 10 51 2 43 75 >-
| 36
68 19 60 11 52 3 44 >-
| 77
28 69 20 61 12 53 4 >}
>>> The most common use for these Kameas is to provide a pattern upon which to construct the sigils
Sigil (magic)

A sigil is a symbol created for a specific magical purpose. A sigil is usually made up of a complex combination of several specific symbols or geometric figures each with a specific meaning or intent....
 of spirit
Spirit

The English word "spirit" comes from the Latin "spiritus" . The term is commonly used to refer to a supernatural being which is transcendence and therefore metaphysical in nature....
s, angel
Ángel

?ngel is the third single from Belinda Peregr?n's debut album: Belinda. It was a massive hit in Mexico and an international hit for Belinda....
s or demon
Demon

In religion, folklore, and mythology a demon is a supernatural being that is generally described as a malevolent spirit. In Christian terms demons are generally understood as fallen angels, formerly of God....
s; 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 square
Word square

A word square is a special case of acrostic. It consists of a set of words, all having the same number of letters as the total number of words ; when the words are written out in a square grid horizontally, the same set of words can be read vertically....
s or number squares found in magical grimoire
Grimoire

A grimoire is a textbook of Magic . Books of this genre, typically giving instructions for invocation angels or demons, performing divination and gaining magical powers, have circulated throughout Europe since the Middle Ages....
s, 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
Sator Arepo Tenet Opera Rotas

The Sator Square is a word square containing a Latin palindrome featuring the words SATOR AREPO TENET OPERA ROTAS written in a Square so that they may be read top-to-bottom, bottom-to-top, left-to-right, and right-to-left....
, one of the most famous magic squares found in a number of grimoires including the Key of Solomon
Key of Solomon

The Key of Solomon, Clavis Salomonis, is a medieval book on magic originally attributed to King Solomon. It is sometimes used as a grimoire....
; a square "to overcome envy", from The Book of Power; and two squares from The Book of the Sacred Magic of Abramelin the Mage
The Book of the Sacred Magic of Abramelin the Mage

The Book of Abramelin tells the story of an Egyptian magic named Abramelin the Mage, or Abra-Melin, who teaches a system of Magic to Abraham of Worms, a Germany Jew presumed to have lived from c.1362 - c.1458....
, 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
Invocation

An invocation may take the form of:*Supplication or prayer.*A form of Spirit possession.*Command or conjuration.*Self-identification with certain spirits....
:




| S
A T O >-
| A
R E P >-
| T
E N E >-
| O
P E R >-
| R
O T A >}

| 6
ery similar to the Melancholia magic square, but it has had the numbers in four of the cells reduced by 1.
66 848 >-
| 8
11 544 >-
| 1
11 383 >-
| 2
73 774 >}

| H
f the 4 queens puzzle
Eight queens puzzle

The eight queens puzzle is the problem of putting eight chess Queen s on an 8?8 chessboard such that none of them is able to capture any other using the standard chess queen's moves....
 ), 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.
E S E >-
| E
Q A L >-
| S
>-
| E
G >-
| B
>}

| A

D A >-
| D
A R >-
| A
R A >-
| M
A D >}
>>>>

Albrecht Dürer's magic square


The order-4 magic square in Albrecht Dürer
Albrecht Dürer

'Albrecht D?rer' was a Germans Painting, printmaker and theorist from Nuremberg. His still-famous works include the Apocalypse woodcuts, commons:Image:Duerer - Ritter, Tod und Teufel .jpg , St....
's engraving Melencolia I is believed to be the first seen in European art. It is very similar to Yang Hui
Yang Hui

Yang Hui , courtesy name Qianguang , was a China mathematician from Qiantang , Zhejiang province during the late Song Dynasty . Yang worked on magic squares, magic circle and binomial theorem, and is best known for his contribution of presenting 'Yang Hui's Triangle'....
'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
Queen (chess)

The queen is the most powerful chess piece in the game of chess. Each player starts the game with one queen, placed in the middle of their first rank next to their King ....
 in the two solutions >
<>d> 16
3 2 13
5 10 11 8
9 6 7 12
4 15 14 1


The Sagrada Família magic square

Ms Sf 2
The Passion façade of the Sagrada Família
Sagrada Familia

The Temple Expiatori de la Sagrada Fam?lia , often simply called the Sagrada Fam?lia, is a massive Roman Catholic church under construction in Barcelona, Catalonia, Spain....
 church in Barcelona
Barcelona

Barcelona is the capital and most populous city of the Autonomous communities of Spain of Catalonia and the second largest city in Spain, with a population of 1,615,908 in 2008, while the population of the Metropolitan Area was 3,161,081....
, designed by sculptor Josep Subirachs, features a 4×4 magic square:

The magic constant of the square is 33, the age of Jesus
Jesus

Jesus of Nazareth , also known as Jesus Christ, is the central figure of Christianity and is revered by most Christian churches as the Son of God and the Incarnation ....
 at the time of the Passion
Passion (Christianity)

The Passion is the Christian theological term used for the events and suffering ? physical, spiritual, and mental ? of Jesus in the hours before and including his trial and execution by crucifixion....
. Structurally, it is >
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.

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
John Horton Conway

John Horton Conway is a prolific mathematician active in the theory of finite group , knot theory, number theory, combinatorial game theory and coding theory....
) and the Strachey method for magic squares
Strachey method for magic squares

The Strachey method for magic squares is an algorithm for generating magic squares of singly even order 4n+2.Example of magic square of order 6 constructed with the Strachey method:...
.

Group theory
Group theory

In mathematics and abstract algebra, group theory studies the algebraic structures known as group .The concept of a group is central to abstract algebra: other well-known algebraic structures, such as ring , field , and vector spaces can all be seen as groups endowed with additional operations and axioms....
 was also used for constructing new magic squares of a given order from one of them, please see . The number of different n×n magic squares for n from 1 to 5, not counting rotations and reflections:
1, 0, 1, 880, 275305224 .
The number for n = 6 has been estimated to 1.7745×1019.

A method for constructing a magic square of odd order


A method for constructing magic squares of odd order was published by the French diplomat de la Loubère in his book A new historical relation of the kingdom of Siam (Du Royaume de Siam, 1693), under the chapter entitled The problem of the magical square according to the Indians. The method operates as follows:

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.




! colspan="3" | step 1
|-
|

1 >-
|
. >-
|
. >}

! colspan="3" | step 2
|-
|

1 >-
|
. >-
|
>}

! colspan="3" | step 3
|-
|

1 >-
| 3
>-
|
>}

! colspan="3" | step 4
|-
|

1 >-
| 3
>-
| 4
>}

! colspan="3" | step 5
|-
|
1 >-
| 3
5 >-
| 4
>}
>>>>>


! colspan="3" | step 6
|-
|
1 >-
| 3
5 >-
| 4
>}


! colspan="3" | step 7
|-
|

1 >-
| 3
5 >-
| 4
>}

! colspan="3" | step 8
|-
| 8

1 >-
| 3
5 >-
| 4
>}

! colspan="3" | step 9
|-
| 8

1 >-
| 3
5 >-
| 4
9 >}
>>>>

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

You can start from any number rather than 1 and continue the same method to derive various patterns of magic squares.




! colspan="3" | Order 3
|-
| 8
1 >-
| 3
5 >-
| 4
9 >}

! colspan="5" | Order 5
|-
| 17
24 1 8 >-
| 23
5 7 14 >-
| 4
6 13 20 >-
| 10
12 19 21 >-
| 11
18 25 2 >}

! colspan="9" | Order 9
|-
| 47

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

The following formulae help construct magic squares of odd order




! colspan="4" | Order
|-
| Squares (n)
Last No. Middle No. *>-
|
>}
> * Square roots are easier to calculate than cubic roots

Example:




! colspan="4" | Order 5
|-
| Squares (n)
Last No. Middle No. >-
| 5
25 13 >}
> 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.

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 left to right 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.


tableneline! colspan="4" | M = Order 4
|-
| 1
>-
|
6 7 >-
|
10 11 >-
| 13
>}

! colspan="4" | M = Order 4
|-
| 1

15 14 >-
|12
6 7 >-
| 8
10 11 >-
| 13
3 2 >}
>>

The medjig-method of constructing magic squares of even number of rows


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.




! colspan="3" | Order 3
|-
| 8
1 >-
| 3
5 >-
| 4
9 >}

! colspan="6" | Medjig 3 x 3
|-
| 2
3 0 2 0 >-
| 1
0 3 1 3 >-
| 3
1 1 2 2 >-
| 0
2 0 3 3 >-
| 3
2 2 0 0 >-
| 0
1 3 1 1 >}

! colspan="6" | Order 6
|-
| 26

35 1 19 6 >-
| 17
8 28 10 33 >-
| 30
12 14 23 25 >-
| 3
21 5 32 34 >-
| 31
22 27 9 2 >-
| 4
13 36 18 11 >}
>>>

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.

The construction of panmagic squares


Any number p in the order-n square can be uniquely written in the form p = an + r, with r chosen from . Note that due to this restriction, a and r are not the usual quotient and remainder of dividing p by n. Consequently the problem of constructing can be split in two problems easier to solve. So, construct two matching square grids of order n satisfying panmagic properties, one for the a-numbers (0,….,n-1), and one for the r-numbers (1,….,n). This requires a lot of puzzling, but can be done. When successful, combine them into one - panmagic - square. Van den Essen and many others supposed this was also the way the great Benjamin Franklin
Benjamin Franklin

Benjamin Franklin was one of the Founding Fathers of the United States of the United States. A noted polymath, Franklin was a leading author and Printer , Satire, list of political philosophers, politician, scientist, inventor, activism, statesman, and diplomacy....
 (1706-1790) constructed his famous franklin squares. Three panmagic squares are shown below. The first two squares have been constructed April 2007 by Barink, the third one is some years older, and comes from Donald Morris, who used, as he supposes, the franklin way of construction.



! colspan="8" | Order 8, sum 260
|-
| 62
4 13 51 46 20 29 >-
| 5
59 54 12 21 43 38 >-
| 52
14 3 61 36 30 19 >-
| 11
53 60 6 27 37 44 >-
| 64
2 15 49 48 18 31 >-
| 7
57 56 10 23 41 40 >-
| 50
16 1 63 34 32 17 >-
| 9
55 58 8 25 39 42 >}

! colspan="12" | Order 12, sum 870
|-
| 138
8 17 127 114 32 41 103 90 56 65 >-
| 19
125 140 6 43 101 116 30 67 77 92 >-
| 128
18 7 137 104 42 31 113 80 66 55 >-
| 5
139 126 20 29 115 102 44 53 91 78 >-
| 136
10 15 129 112 34 39 105 88 58 63 >-
| 21
123 142 4 45 99 118 28 69 75 94 >-
| 130
16 9 135 106 40 33 111 82 64 57 >-
| 3
141 124 22 27 117 100 46 51 93 76 >-
| 134
12 13 131 110 36 37 107 86 60 61 >-
| 23
121 144 2 47 97 120 26 71 73 96 >-
| 132
14 11 133 108 38 35 109 84 62 59 >-
| 1
143 122 24 25 119 98 48 49 95 74 >}

! colspan="12" | Order 12, sum 870
|-
| 1

120 121 48 85 72 73 60 97 24 25 -
| 142
27 22 99 58 75 70 87 46 123 118 >-
| 11
110 131 38 95 62 83 50 107 14 35 >-
| 136
33 16 105 52 81 64 93 40 129 112 >-
| 8
113 128 41 92 65 80 53 104 17 32 >-
| 138
31 18 103 54 79 66 91 42 127 114 >-
| 5
116 125 44 89 68 77 56 101 20 29 >-
| 139
30 19 102 55 78 67 90 43 126 115 >-
| 12
109 132 37 96 61 84 49 108 13 36 >-
| 135
34 15 106 51 82 63 94 39 130 111 >-
| 2
119 122 47 86 71 74 59 98 23 26 >-
| 141
28 21 100 57 76 69 88 45 124 117 >}
>>>

The order 8 square satisfies all panmagic properties, including the franklin ones. It consists of 4 perfectly panmagic 4x4 units. Note that both order 12 squares show the property that any row or column can be divided in three parts having a sum of 290 (= 1/3 of the total sum of a row or column). This property compensates the absence of the more standard panmagic franklin property that any 1/2 row or column shows the sum of 1/2 of the total. For the rest the order 12 squares differ a lot.The Barink 12x12 square is composed of 9 perfectly panmagic 4x4 units, moreover any 4 consecutive numbers starting on any odd place in a row or column show a sum of 290. The Morris 12x12 square lacks these properties, but on the contrary shows constant franklindiagonals. For a better understanding of the constructing decompose the squares as described above, and see how it was done. And note the difference between the Barink constructions on the one hand, and the Morris/Franklin construction on the other hand.

In the book Mathematics in the Time-Life Science Library Series, magic squares by Euler and Franklin are shown. Franklin designed this one so that any four-square subset (any four contiguous squares that form a larger square, or any four squares equidistant from the center) total 130. In Euler's square, the rows and columns each total 260, and halfway they total 130--and a chess
Chess

Chess is a recreational and competitive game played between two Player . Sometimes called Western chess or international chess to distinguish it from History of chess and other chess variants, the current form of the game emerged in Southern Europe during the second half of the 15th century after evolving from similar, much older...
 knight, making its L-shaped moves on the square, can touch all 64 boxes in consecutive numerical order.

The construction of a magic square using genetic algorithms

A magic square can be constructed using genetic algorithms. This is an elegant trial and error process in which an initial population of magic squares with random values are generated. The fitnesses of these individual magic square are calculated based on the "flatness" of the magic square, that is, the degree of deviation in the sums of the rows, columns, and diagonals. The population of magic squares will interbreed (exchange values) in a manner coherent to genetics, based on the fitness score of the magic squares. Thus, magic squares with a higher fitness score will have a higher likelihood of reproducing. In the interbreeding process where the magic squares exchange their values, a mutation factor is introduced, imitating genetic mutation in nature. This mutation will be included or naturally excluded from the solution depending on their contribution to the fitness of the magic square. The next generation of the magic square population is again calculated for their fitness, and this process continues until a solution has been found.

Generalizations


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
Panmagic square

A panmagic square, pandiagonal magic square, diabolic square, diabolical square or diabolical magic square is a magic square with the additional property that the broken diagonals, i.e....
. If raising each number to certain powers yields another magic square, the result is a bimagic
Bimagic square

In mathematics, a bimagic square is a magic square that also remains magic if all of the numbers it contains are squared. The first known bimagic square has order 8 and magic constant 260; it has been conjectured by Bensen and Jacoby that no nontrivial bimagic squares of order less than 8 exist....
, a trimagic
Trimagic square

In mathematics, a trimagic square is a magic square that also remains magic if all of the numbers it contains are squared or cubed. Trimagic squares of orders 12, 32, 64, 81 and 128 have been discovered so far; the only known trimagic square of order 12, given below, was found in June 2002 by Germany mathematician Walter Trump....
, or, in general, a multimagic square
Multimagic square

In mathematics, a P-multimagic square is a magic square that remains magic even if all its numbers are replaced by their kth power for 1 ≤ k ≤ P....
.

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 heterosquare
Heterosquare

A heterosquare of order n is an arrangement of the integers 1 to n? in a square, such that the rows, columns, and diagonals all sum to different values....
s and antimagic square
Antimagic square

An antimagic square of order n is an arrangement of the numbers 1 to n? in a square, such that the n rows, the n columns and the two diagonals form a sequence of 2n + 2 consecutive integers....
s, 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.



! colspan="3" | M = 216
|-
| 2
9 >-
| 36
6 >-
| 3
4 >}

! colspan="4" | M = 6720
|-
| 1

6 20 >-
| 40
28 2 >-
| 14
5 24 >-
| 12
8 7 >}
>>

Other magic shapes

Other shapes than squares can be considered, resulting, for example, in magic star
Magic star

An n-pointed magic star is a star polygon with Schl?fli symbol in which numbers are placed at each of the n vertex and n intersections, such that the four numbers on each line sum to the same magic constant....
s and magic hexagon
Magic hexagon

A magic hexagon of order n is an arrangement of numbers in a centered hexagonal number with n cells on each edge, in such a way that the numbers in each row, in all three directions, sum to the same magic constant....
s. Going up in dimension results in magic cube
Magic cube

In mathematics, a magic cube is the dimension equivalent of a magic square, that is, a number of integers arranged in a n'' x n'' x n'' pattern such that the sum of the numbers on each row, each column, each pillar and the four main space diagonals is equal to a single number, the so-called magic constant of the cube, denoted M''...
s, magic tesseract
Magic tesseract

In mathematics, a magic tesseract is the 4-dimensional counterpart of a magic square and magic cube, that is, a number of integers arranged in an n × n × n × n pattern such that the sum of the numbers on each pillar as well as the main space diagonals is equal to a single number, the so-called magic constant...
s and other magic hypercube
Magic hypercube

In mathematics, a magic hypercube is the dimension generalization of magic squares, magic cubes and magic tesseracts, that is, a number of integers arranged in an n x n x n x ......
s.

Edward Shineman, an internationally renowned magic shape constructionist, has developed yet another design in the shape of magic diamonds. He has made many of these for commemorative and historical purposes, and has also experimented with other self-contained double rectangle/square combinations, L-shaped "lightening" figures, and more. The diamonds have been made in honor of events and people ranging from Tiger Woods to Ronald Reagan, from Cornell University anniversary's to special family birthdays. Several of his works have been featured in magic square books, as well as multiple publications in The Journal of Recreational Mathematics. An array of his magical contributions can be found at eds-magic-squares.com.

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


Over the years, many mathematicians, including Euler and Cayley
Arthur Cayley

Arthur Cayley was a British mathematician. He helped found the modern British school of pure mathematics.As a child, Cayley enjoyed solving complex maths problems for amusement....
 have worked on magic squares, and discovered fascinating relations.

Magic square of primes

Rudolf Ondrejka (1928-2001) discovered the following 3x3 magic square of primes
Prime number

In mathematics, a prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. An infinitude of prime numbers exists, as demonstrated by Euclid around 300 BC....
, in this case nine Chen prime
Chen prime

A prime number p is called a Chen prime if p + 2 is either a prime or a semiprime. The even number 2p + 2 therefore satisfies Chen's theorem....
s:
17 89 71
113 59 5
47 29 101


The Green-Tao theorem
Green-Tao theorem

In mathematics, the Green?Tao theorem, proved by Ben J. Green and Terence Tao in 2004, states that the sequence of prime numbers contains arbitrarily long arithmetic progressions....
 implies that there are arbitrarily large magic squares consisting of primes.

n-Queens problem

In 1992, Demirörs, Rafraf, and Tanik published a method for converting some magic squares into N-queens
Eight queens puzzle

The eight queens puzzle is the problem of putting eight chess Queen s on an 8?8 chessboard such that none of them is able to capture any other using the standard chess queen's moves....
 solutions, and vice versa.

Date magic square

A date magic square is a 4×4 magic square in which the numbers in a given date (for example, April 15, 1707) are used to construct the first row (4, 15, 17, 07). The magic constant
Magic constant

The magic constant or magic sum of a magic square is the sum of numbers in any row, column, and diagonal of the magic square. For example, the magic square shown below has a magic constant of 15....
 (M) of a 4×4 'normal' magic square is 34. If the four numbers in a date don't add up to 34, we cannot construct a 'normal' magic square for that date. In the above example, M=43:
4 15 17 07
5 19 13 6
20 9 2 12
14 0 11 18


The only difference between a magic square and a date magic square is that, in a date magic square repetition of numbers is not allowed in any row except the first one, whereas in a 'normal' magic square, repetition is not allowed in any row.

Number/Word Magic Square

A Number/Word combination magic square is constructed using the following three rules:

  1. Make a normal magic square of order 3 using any numbers.
  2. Count the number of letters in each number and replace the number with this count.
  3. The new square must also be magic.


An example of such a square is shown below:




! colspan="3" | Sum = 45
|-
| 5 >
22 >-
| 28
15 >-
| 12
8 >}

! colspan="3" | Words
|-
| five


Magic Squares in contemporary literature

In Chapter 2 of The Great Brain is Back by John D. Fitzgerald
John D. Fitzgerald

John Dennis Fitzgerald was an United States author.Fitgerald was born in Price, Utah, Utah, the son of an Irish ethnicity Catholic father and a Scandinavian Mormon mother....
, Tom, alias the "Great Brain", remembers having been told by a teacher about a magic square. After working on it for three days, he comes up with the Order 3, Sum 15 square. He then sets up the "numbers game", rounding up his friends and explaining the concept, charging 10 cents to play with a 50 cent prize for anyone who can solve it within two days, handing out a sheet with the 3*3 grid and the numbers one through nine to every player, and giving permission to all participants to get the help of their parents. Thinking it will be easy, all 20 kids present including his brother John (the narrator) opt to play and give him a dime. John shows it to their father, the only college graduate in town. His father explains that the first thing to do is to make a list of all the combinations of three numbers from 1 to 9 which total 15, excluding those in which one number is used more than once. Then (showing a lack of expertise on the subject) he says you have to "keep trying the different combinations until you get the right answer." John makes the list, and spends every free moment he has over the next two days trying to put the combinations together, without success. His father tells him to do it by elimination and start with the three squares in the middle, but does not elaborate. After two days, no one has solved it, and some believe that it can't be done. But when the deadline passes and there are no winners, Tom reveals the answer.

In Steve Martin
Steve Martin

Stephen Glenn "Steve" Martin is an Emmy Award-winning United States actor, comedian, writer, playwright, Film producer, musician, and composer....
's novel The Pleasure of My Company
The Pleasure of My Company

The Pleasure of My Company is a novel by Steve Martin, first 2003 in literature, which tells the story of the life of an obsessive compulsive and introverted young man named Daniel Cambridge....
, the main character Daniel Pecan Cambridge builds magic squares as a way to relax.

David Gilman's 2008 novel "Ice Claw" includes a magic square which the hero believes to be a coded message.

Rick Riordan's "The 39 Clues" has a 4x4 magic square.

See also


Further reading

  • Charney, Noah The Art Thief Atria (2007), a novel with a key plot point involving a magic square.


twenty two >-
| twenty eight
fifteen >-
| twelve
eight >}

! colspan="3" | Sum = 21
|-
| 4

9 >-
| 11
7 >-
| 6
5 >}
>>