Log in Sign up
Back to Discover
🔢

Magic square

math Maturity 7-9 supernatural
This article covers sensitive topics: supernatural. Parents can manage visibility in Parental Controls.

Imagine a box of numbers.

Magicsquareexample.svg
Magicsquareexample.svg
All the rows add up to the same sum. All the columns do too. Even the lines from corner to corner match!
Yuan dynasty iron magic square.jpg
Yuan dynasty iron magic square.jpg
People have loved these for a long time. It is like a fun puzzle. Can you find the pattern?

52 words

Imagine a box of numbers.

Magicsquareexample.svg
Magicsquareexample.svg
In a magic square, the numbers follow a rule. If you add up each row, they match. Each column adds up to that same number, too. Even the lines from corner to corner work!
Yuan dynasty iron magic square.jpg
Yuan dynasty iron magic square.jpg

People have used these for a very long time. Some were found in China a long time ago. In India, people used them to make perfumes.

Hindi Manuscript 317, folio 2b Wellcome L0024035.jpg
Hindi Manuscript 317, folio 2b Wellcome L0024035.jpg
Artists even put them in beautiful paintings. These number puzzles are still fun to study today.

94 words

Imagine a grid filled with numbers.

Magicsquareexample.svg
Magicsquareexample.svg
In a magic square, these numbers follow a special rule. If you add up the numbers in any row, they reach a set total. The columns must reach that same total. Even the lines from corner to corner must match. This total is called the magic constant.
Yuan dynasty iron magic square.jpg
Yuan dynasty iron magic square.jpg

People have loved these number puzzles for a long time. The oldest records come from China around 190 BCE.

Magic square Lo Shu.png
Magic square Lo Shu.png
In India, people used magic squares for many things. One old book used them to help make perfumes. Another text used them to help women in labor.
Hindi Manuscript 317, folio 2b Wellcome L0024035.jpg
Hindi Manuscript 317, folio 2b Wellcome L0024035.jpg
Artists also used them in art. The artist Albrecht Dürer put one in a famous painting.
Albrecht Dürer - Melencolia I (detail).jpg
Albrecht Dürer - Melencolia I (detail).jpg
Today, math experts still study how to make them. They look at how many different squares can exist. Finding all the squares for large grids is still a hard puzzle.

168 words

Imagine a square grid filled with numbers.

Magicsquareexample.svg
Magicsquareexample.svg
In a magic square, these numbers follow a very strict rule. If you add up the numbers in any row, they reach a specific total. The columns must also reach that same total. Even the two main diagonal lines from corner to corner must match. This special total is called the magic constant.
Yuan dynasty iron magic square.jpg
Yuan dynasty iron magic square.jpg
A square is called "normal" if it uses only positive integers without repeating any. If some rows or columns match the total but the diagonals do not, it is a semimagic square. Mathematicians study how to build these grids and how many different versions can exist.

Building these squares can be a very hard job. There is no single way to make every kind of magic square. However, people have discovered three main techniques over time. One way is called bordering, where you build around the outside. Another way is making composite magic squares from smaller ones. A third way involves adding two preliminary squares together.

4x4 magic square hierarchy.svg
4x4 magic square hierarchy.svg
Experts also group squares by their size, or "order." They look at whether the number of cells on a side is odd, doubly even, or singly even. This helps them know which building method to use.

People have been fascinated by these patterns for thousands of years. The earliest records come from China around 190 BCE.

Magic square Lo Shu.png
Magic square Lo Shu.png
In ancient China, a 3x3 square was known as the "Nine Halls." By the 12th century, people called it the Luoshu square. In 1275, a writer named Yang Hui shared many different squares. He showed squares of order 3 all the way up to order 9.
Suanfatongzong-790-790.jpg
Suanfatongzong-790-790.jpg
He even showed a semi-magic square with 10 cells on each side. These patterns were often used for things like astrology or divination.

Other cultures also found special uses for these number grids. In India, a 3x3 square appeared in a text by Vrnda. This book was used to help women during labor. Another Indian text from around 587 CE used a 4x4 square to help make perfumes.

Hindi Manuscript 317, folio 2b Wellcome L0024035.jpg
Hindi Manuscript 317, folio 2b Wellcome L0024035.jpg
In Japan, mathematicians studied these squares deeply during the 17th century. A man named Seki Takakazu wrote a whole book about them in 1683. He described clear ways to build many different types of squares. By the early 1700s, Japanese scholars could build squares of almost any size.

Magic squares have even appeared in famous works of art. The artist Albrecht Dürer included an order 4 square in his 1514 painting, Melencolia I.

Albrecht Dürer - Melencolia I (detail).jpg
Albrecht Dürer - Melencolia I (detail).jpg
This specific square has a magic constant of 34. You can also find them in the work of Wifredo Lam. Even today, math is changing how we see these squares. Some people use multiplication instead of addition. Others use shapes instead of numbers to create new patterns. The study of these grids remains a wonderful part of math history.

493 words

A magic square is a specialized square array of numbers.

Magicsquareexample.svg
Magicsquareexample.svg
Most often, these arrays use positive integers. A square is considered magic if the sum of every row, every column, and both main diagonals is identical. This shared sum is known as the magic constant. The size of the square is defined by its order, which is the number of integers along one side.
Yuan dynasty iron magic square.jpg
Yuan dynasty iron magic square.jpg
If a square uses the set of consecutive positive integers without any repeats, it is called a normal magic square. If the rows and columns reach the magic constant but the diagonals do not, it is called a semimagic square.
Euler knight tour semimagic square.svg
Euler knight tour semimagic square.svg

Mathematicians study magic squares through construction, classification, and enumeration. Construction refers to the methods used to build these grids. While no single method works for every possible magic square, three general techniques are known. One technique is called bordering, where a square is built by adding layers around a central core. Another method involves making composite magic squares, which are built from smaller magic squares. A third technique involves adding two preliminary squares together to create a new one.

4x4 magic square hierarchy.svg
4x4 magic square hierarchy.svg
Other specific strategies, such as continuous enumeration, can reproduce very specific patterns.

Magic squares are classified into different types based on their order, or the number of cells on a side. They are categorized as odd if the order is an odd number. If the order is a multiple of 4, the square is called doubly even, or evenly even. If the order is even but not a multiple of 4, it is called singly even, or oddly even. This classification is vital because different construction techniques are required for each type. Beyond this, squares can be classified by further properties. These include associative magic squares, pandiagonal magic squares, and most-perfect magic squares.

Geomagic square - Diamonds.jpg
Geomagic square - Diamonds.jpg

The history of magic squares spans thousands of years. The earliest recorded instances date back to at least 190 BCE in China.

Magic square Lo Shu.png
Magic square Lo Shu.png
In the 1st century CE, a Chinese book called Da Dai Liji described the 3x3 square. This square was also mentioned in a mathematical text called Shushu jiyi. By the 12th century, Chinese mathematicians identified the 3x3 square as the Luoshu square. In 1275, the scholar Yang Hui published a treatise containing many squares. He provided squares of order 3, two versions for each order from 4 to 8, an order 9 square, and a semimagic square of order 10.
Suanfatongzong-790-790.jpg
Suanfatongzong-790-790.jpg

Other cultures developed unique uses for these mathematical patterns. In India, the 3x3 magic square appeared in the text Gargasamhita to pacify the nine planets. A medical text by Vrnda also used the 3x3 square to assist women in labor. Around 587 CE, the Indian scholar Varahamihira used a 4x4 magic square in the Brhat Samhita. This square was used to determine the proportions of four substances for making perfumes.

Hindi Manuscript 317, folio 2b Wellcome L0024035.jpg
Hindi Manuscript 317, folio 2b Wellcome L0024035.jpg
In the Middle East, magic squares were used for occult purposes. The famous Arabic book Shams Al-ma'arif, written by Ahmed bin Ali Al-boni, featured magic letters and squares. These squares eventually reached Europe through the translation of Arabic texts during the Renaissance.

Japan also developed a deep mathematical tradition involving magic squares. This interest grew in the 17th century following the spread of Chinese works. In 1683, Seki Takakazu published Hojin Yensan, a book entirely devoted to magic squares and circles. This was the first Japanese text to provide a general treatment of the subject. It clearly described algorithms for constructing odd, singly even, and doubly even bordered squares. By the start of the 18th century, Japanese mathematicians could construct squares of almost any order. Some scholars even attempted to enumerate them, such as Nushizumi Yamaji.

Magic squares have also left a lasting mark on the world of art. The artist Albrecht Dürer included an order 4 magic square in his 1514 engraving, Melencolia I.

Albrecht Dürer - Melencolia I (detail).jpg
Albrecht Dürer - Melencolia I (detail).jpg
This specific square has a magic constant of 34. Another example appears in the painting Bélial, Emperor of the Flies, by Wifredo Lam. In modern mathematics, the concept has been generalized even further. Researchers now explore magic squares using multiplication instead of addition. They also study them in different dimensions, using shapes instead of numbers or different geometric operations.

722 words
🖼️ Images & Media (19)
File:Magicsquareexample.svg
Magicsquareexample.svg
File:Dürer Melancholia I.jpg
Dürer Melancholia I.jpg
File:Albrecht Dürer - Melencolia I (detail).jpg
Albrecht Dürer - Melencolia I (detail).jpg
File:Yuan dynasty iron magic square.jpg
Yuan dynasty iron magic square.jpg
File:Suanfatongzong-790-790.jpg
Suanfatongzong-790-790.jpg
File:Hindi Manuscript 317, folio 2b Wellcome L0024035.jpg
Hindi Manuscript 317, folio 2b Wellcome...
File:16th century arabic magic square.jpg
16th century arabic magic square.jpg
File:Sigillum Iovis.jpg
Sigillum Iovis.jpg
File:Siamese Square.jpg
Siamese Square.jpg
File:Magic square Lo Shu.png
Magic square Lo Shu.png
File:Magic square at the Parshvanatha temple, Khajuraho.png
Magic square at the Parshvanatha temple,...
File:Barcelona Sagrada Familia passion facade magic square.jpg
Barcelona Sagrada Familia passion facade...

+ 7 more

Up Next
🔢
Latin square
Math
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.