Talk:Magic square

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Mathematics (Rated B-class, Mid-importance)
WikiProject Mathematics
This article is within the scope of WikiProject Mathematics, a collaborative effort to improve the coverage of Mathematics on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Mathematics rating:
B Class
Mid Importance
 Field: General
One of the 500 most frequently viewed mathematics articles.

Genetic Algorithms[edit]

The idea of using genetic algorithms to construct magic squares seems dubious, given that different solutions have unrelated arrangements of numbers. The page used as a reference certainly does not support the idea: I have not seen the java program it provides successfully generate a single 4x4 magic square!

M+N, M*N, kM[edit]

I believe that if two matrices M, N are magic squares, then M+N, M*N, kM are also magic squares. If I'm right, could someone add this?

Also, out of interest -- let M be the set of all n x n magic squares, for some n. Let V be the real vector space (M,+), where + is matrix addition. Does V exist? How many dimensions has V? Can you give a basis for V? (I am asking this question for all n, but would appreciate answers even for a particular n > 1). -- SJK

Addition of magic squares produces magic squares (ignoring that the coefficients are not consecutive integers). Multiplication of magic squares, however, does not: 8163574922 is
91 67 67
67 91 67
67 67 91. -phma

To SJK:[edit]

Provided your definition of a magic square is just that the columns, rows and long diagonals have the same sum, then the magic squares with real entries do form a vector space over R.

For n = 2, the dimension is 1, because all the entries must be equal.

For n = 3, the dimension is 3, because you can choose the first row freely, but this then determines all the remaining entries. The following three matrices form a basis:

/ 3  0  0 \      / 0  3  0 \      / 0  0  3 \
|-2  1  4 |      | 1  1  1 |      | 4  1 -2 |
\ 2  2 -1 /      \ 2 -1  2 /      \-1  2  2 /

I don't know how to determine the dimension in general, although it must be at least n2-2n-1 and no more than n2. --Zundark 14:51 Sep 13, 2002 (UTC)

The dimension is well known to be n2-2n-1. Zaslav 03:17, 23 January 2006 (UTC)

Actually, it's n2-2n The math works out this way, and I can give bases for the 3x3 and 4x4 vector space (of size 3 and 8 resp.) -- (talk) 05:11, 24 April 2009 (UTC)
Figured out the confusion: the well-known result (the extra minus one) is WITH the restriction to the first consecutive n2 integers. This restriction fixes the magic number, reducing the number of unknowns by one, but it also destroys the vector spaceness of the set. —Preceding unsigned comment added by Quintopia (talkcontribs) 18:04, 24 April 2009 (UTC)

Loh-Shu magic square[edit]

Isn't there a legend that the Loh-Shu magic square was first seen written on the shell of a turtle? -- Tarquin 21:34 Feb 1, 2003 (UTC)

See [1] Cheers Chas zzz brown 07:59 Feb 2, 2003 (UTC)
See Lo Shu Square. —Herbee 17:53, 20 Mar 2005 (UTC)

The following section is not very enlightening, so I'm taking it out until someone can elaborate.

Euler showed how to derive magic squares from Latin squares.

Herbee 18:01, 20 Mar 2005 (UTC)

Yes, It is a legend. So that I personally believe that it is not a truth.--Meavel 06:05, 8 July 2007 (UTC)


  • Halló! I have some problems with the definition: Both according to Mathworld and to Harvey Heinz (this link should be included at #External links) the numbers start with 1 and end with n2.
  • I would suggest that Wikipedia should use the same definition. To my understanding the "other" squares are somehow related or just simple "magic patterns".
  • For analysis purposes more equivalent representations can be given: numbers from 0 to n2-1; odd numbers from -n2+1 to n2-1 and probably others.
  • I developed a set of templates to be used to ilustrate many properties of 4x4 type magic squares at meta:Category:4x4 type square. Please let me know if you have some time to work on this subject and to help to make a wikibook at en: in other languages. We should make some documenation first and a list of items to work on. Thanks in advance! Best regards Gangleri | Th | T 22:40, 28 July 2005 (UTC)

The term "magic square" covers many different though related ideas. They all have in common that the rows and columns have the same "magic sum". The diagonals should be included, but research mathematicians have often been very sloppy about that and other requirements; properly, a square that is magic for rows and columns, ignoring the diagonals, is "semimagic", not "magic". Recreational mathematicians (a different group from research mathematicians) have always included the diagonal sums in the requirements. I also have never heard of any magic squares whose entries are not integers, except in the vector-space generalization alluded to in another comment. Historically, squares with negative entries seem not to have appeared, but squares with 0 have appeared (centuries ago) and squares with entries that are consecutive integers but not starting with 1 have also appeared for centuries (usually, I think, as tools to make larger squares out of smaller ones). Squares with entries that are nonconsecutive integers have been studied in the twentieth century and possibly the nineteenth. Thus, your two references are excessively narrow and not historically justified.

Subtracting or adding any constant to the entries of a magic square, e.g., 1, will always give a magic square. This is so obvious that it seems silly to discuss it at length. (It might be worth a mention in the appropriate subsection, if there is one.)

Zaslav 03:28, 23 January 2006 (UTC)

Yang Hui's square and "table of Jupiter"[edit]

Constructing a magic square of doubly even order[edit]

It is necessary write the numbers from right to left? (Keyword: symmetry)

Western occult[edit]

  • Durer's Melancholia square, noted in the article, is reportedly based on the magic squares of his contemporary, occultist Heinrich Cornelius Agrippa. [2] Agrippa apparently assigned magic squares of the orders of 3 through 9 to the planets (and astrological/alchemical figures) Saturn, Jupiter, Mars, Sol (the sun), Venus, Mercury, and Luna (the moon) respectively, hence the "table of Jupiter" noted above. (See Agrippa's text for more.) I believe his "tables" would be inscribed on magic talismans, in hopes of harnessing the various virtues and powers of each particular planet.

Historic image available[edit]

If anyone's interested, I just uploaded Image:16th century arabic magic square.jpg. Couldn't see an obvious place to add it, so I thought I'd just let you know. — Laura Scudder 01:40, 10 February 2006 (UTC)

Ben Franklin and others[edit]

Mr. Franklin was a great fan of magic squares, and created quite a few HUGE (16x16, 24x24) magic squares with a number of interesting attributes.

I also recall a magic square that had to do with the 365 days in our year. After a brief web search, I found on this site: that it says "This 27 x 27 Magic Square Calendar has, as its central cell, the number 365 which is the number of days in a solar year. It has 364 dark cells which represent the number of nights, and 365 white cells which represent the number of days. The Magic Sum of the inner and central 3x3 square is 1,095 being the number of days in a 3 year period. The Magic Sum of the 9x9 square is 3,285 being the number of days in a 9 year period. The Magic Sum of the whole 27x27 square is 9,855 being the number of days in a 27 year period."

I also recall a few other crazy interesting magic squares ( is neat), and know that there have been some famous people (besides Franklin and Durer) that dabbled with/used magic squares.

If anyone wants to run with this idea to add a section on a list of famous people who played with magic squares or who wants to add a section talking about the many connections with various occultist/whatever things ... go ahead. Email me at cht13er a t gmaildotcom if you like :-) cheater 14:03, 15 March 2006 (UTC)

Magic Squares of odd order[edit]

Perhaps I have missed something, but aren't the first and second paragraphs of this section saying the same thing? Bio 18:08, 22 November 2006 (UTC)

Source of info[edit]

I saw this site on smagic quares and I think the construction of magic squares there is easier. Can someone investigate this? --Blonkm 02:38, 17 December 2006 (UTC)


Islam is a religion, I think the part titled "Islam" should be renamed. It is about arabic uses of magic squares. It should be called "Arabs".

What about mid-eastern? Yongke 17:09, 11 March 2007 (UTC)

More "See also"[edit]

I moved 2 cube links to end, then added 3 hypercube links.Harvey Heinz 17:11, 12 September 2007 (UTC)

"Middle Number" and "Last Number"[edit]

In the section describing how to construct a magic square of odd order, the article posted two assertions about the properties of "Middle Number" and "Last Number", namely:

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.

Queries. Counterexample for a magic square of order 5:

3 9 12 20 21
17 25 1 8 14
6 13 19 22 5
24 2 10 11 18
15 16 23 4 7

The "Middle Number" is 13, the "Last Number" is 25, but 13 (Middle Number) is not always in the diagonal bottom left to top right and 25 (Last Number) is not always opposite 1 in an outside column or row for an order 5 (odd order) magic square.

A very good site on magic square, where I found the counterexample from, is

In my opinion, an order n magic square must be a square array of natural numbers from 1 to n2 arranged in a way such that every row, every column, and the two diagonals all sum to a constant. Other so-called magic squares that do not fit to this definition are not considered "magical" and beautiful for me. But again, that's just my opinion.

By the way, this article is hard to follow and seriously needs a lot of decoration, the magic squares look horrible.

Wei Cheng (talk) 10:30, 14 June 2008 (UTC)

The section is called "A method for constructing a magic square of odd order". The statements about the middle and last number only apply to magic squares constructed with that method. You are right that there exist other magic squares not having the same property. PrimeHunter (talk) 11:14, 14 June 2008 (UTC)
Thank you, PrimeHunter, for pointing out my mistakes. I skimmed the article, so I didn't pay close attention to the wording. I would delete the formulae under that section since it is kind of trivial, insignificant and useless. We are already told an easy method of constructing odd order magic squares, so why bother with the more complicated formulae, which only help locate two numbers? Also, for the history of magic squares, why not just directly link from the Lo Shu Square article, with the pictorial graph of order 3 magic square rather than the modern representation? Wei Cheng (talk) 10:08, 15 June 2008 (UTC)

Siamese method[edit]

A simple example of the Siamese method. Starting with "1", boxes are filled diagonally up and right (↗). When a move would leave the square, it is wrapped around to the last row or first column, respectively. If a filled box is encountered, one moves vertically down one box (↓) instead, then continuing as before.

Here a nice animation of the Siamese method, which I guess could be used also in the main Magic square article. Cheers PHG (talk) 04:05, 19 August 2008 (UTC)

Special Case for 3x3[edit]

I was combing the internet trying to find a method to make an arbitrary 3x3 magic square -- not a normalized one. Meaning the sum doesn't have to be 15. I remember in grade school there was a simple method they taught to do it, but I couldn't remember it.

I worked out the trick, or a method. In a 3x3 magic square the center is always 1/3 of the sum. Knowing that it's easy to make an arbitrary magic square. Just choose the top 3 numbers of the square and make sure the sum is a multiple of 3 greater than 15. Say

7 9 2

We know the center square is 6 since the sum is 18. From that you can work out the whole square easily.

7 9 2
1 6 11
10 3 5

Anyway I thought it would be a nice addition to the methods of construction, maybe someone wants to add it in.

David Ashley —Preceding undated comment was added at 03:04, 8 November 2008 (UTC).

Read about this what properties does it have?!?[edit]

I saw this "magic square" somewhere, what properties does it have?!? It's not magic!

89 3 34
8 21 55
13 144 5

Professor M. Fiendish, Esq. 03:23, 13 September 2009 (UTC)

A New Interpretation of Odd Magic Squares in the Lo Shu format[edit]

FYI A New Interpretation of Odd Magic Squares in the Lo Shu format has been prodded now - see Wikipedia talk:WikiProject Mathematics#New article help‎. Rd232 talk 11:30, 19 September 2009 (UTC)

file:2009.10.23 quaternion square 01.png[edit]


‫·‏לערי ריינהארט‏·‏T‏·‏m‏:‏Th‏·‏T‏·‏email me‏·‏‬ 23:09, 22 October 2009 (UTC)

Is This a Spam Link?[edit]

Should be linked to this page? Whie posted on Wikipedia's Magic Squares page, this discussion applies to all magic square catagory articles.

The powers-that-be think that this is a SPAM LINK. but

  • It is one of the oldest sites on magic squares on the Internet.( before being forced to move in late October 2009). The new site URL is
  • It is one of the largest, most comprhensive, and well researched sites on magic hypercubes on the Internet (over 70 MB in 4 interconnected sites).
  • It contains extensive bibliographies, historical quotations and examples, statistics, a timeline, etc.
  • It can supply much additional material and many visual examples in support of this article and the other articles in the Magic Squares catagory).

Links to the above site have now all been removed from all magic square catagory articles. Because of how quickly this happened after my posting, I must assume it was done without proper review. Is that fair? I do not wish to get into a discussion of which web sites are better. But I do see existing links on these pages which clearly do not add to the material in the article at hand.

What do you think? --Harvey Heinz (talk) 23:56, 5 November 2009 (UTC)

Good site. Definitely not a spam link. Machine Elf 1735 (talk) 00:01, 1 January 2010 (UTC)

incorrect information[edit]

I think that some of the information in this article is incorrect. (1) There is no reference to magic squares of planets that I could find in either Agrippa's Three Books of Occult Philosophy or Magic or in Agrippa's Fourth Book of Occult Philosophy. It appears that the information in the wiki article comes from a blog of Mark Swaney. That is certainly not a primary source. If it is indeed from one of the Agrippa books, then that book and the page numbers in the book should be referenced.

(2) The magic square given for the Sun is not the same as that given on page 395 in Budge's book Amulets and Superstitions, Oxford University Press, 1930. —Preceding unsigned comment added by Haralick (talkcontribs) 05:37, 30 May 2010 (UTC)

More "references"[edit]

Added the reference Demirörs, Rafraf, and Tanik (1992). Scribbleink (talk) 22:40, 3 October 2010 (UTC)

Simplified explanation of Melancholia I magic square[edit]

For this magic square it could be noted that any combination of four numbers that exhibit a radial symmetry about the center add up to 34. In other words any four box locations that are in the same locations when the whole square is rotated 180 degrees or sometimes just 90 degrees will add up to 34. This is of course in addition to the other asymmetrical arrangements such as in columns, rows, and the three-square groupings' corners. — Preceding unsigned comment added by Carlsez (talkcontribs) 17:31, 20 January 2011 (UTC)

Cheating dice[edit]

There is a connection between magic squares and cheating dice. For example, use the rows of a 3x3 square as sides of triangular dice A, B and C:

  • A: 8, 1, 6
  • B: 3, 5, 7
  • C: 4, 9, 2

Each dice has the same total number of points. But if you throw any pair of dice:

  • A beats B 5 times out of 9.
  • B beats C 5 times out of 9.
  • C beats A 5 times out of 9.

I have not investigated whether this is true of all additive squares. —Preceding unsigned comment added by (talk) 11:30, 16 March 2011 (UTC)

Unsolved problems in Mathematics?[edit]

I am not sure if Magic Squares should be in the "Unsolved problems in Mathematics" category.

Bande-Ali (talk) 06:08, 27 June 2011 (UTC)

Geomagic squares[edit]

To editor Arthur Rubin: I notice that you reverted my reference to the two new kinds of squares introduced by Lee Sallows, saying, "new generalization is not notable". I want to make a case for geomagic squares, at least, being notable. In Magic squares are given a whole new dimension, The Observer, April 3, 2011 we find

Peter Cameron, professor of mathematics at Queen Mary, University of London, calls geomagic squares "a wonderful new piece of recreational maths, which will delight non-mathematicians and give mathematicians food for thought". Despite the inherent whimsy of the field, he said: "I have no doubt that there is serious maths to be done here, too."

and in Ancient puzzle gets new lease of 'geomagical' life, New Scientist, January 24, 2011 we find

So could geomagic squares have applications outside the study of puzzles? Cameron certainly thinks so. "You can ask these questions in much more general terms," he says.

See at Peter Cameron's blog for more remarks along these lines.

If you truly feel that geomagic squares are not notable, I will not contest it.

Thank you for your time — Foobarnix (talk) 03:32, 6 July 2011 (UTC)

Seems to be a neologism, which has not yet met the test of time. However, it appears to have appeared in the popular press (although New Scientist has been known to publish press releases as news articles.) Cameron's speculation on uses or applications are not much more notable than my speculations would be. I think, perhaps, a sentence in "generalizations" would not be undue weight.
Which is about what you added. My only suggestion is to put the New Scientist article as a reference, rather than as an external link. — Arthur Rubin (talk) 16:35, 8 July 2011 (UTC)
Thank you Arthur Rubin for your thoughtful response. I think you said it is all right to put the reference back in and I have done so. However, I did remove the mention of Sallows's alphamagic squares which I would agree with you are not mathematically significant. I cited the Guardian/Observer article rather than New Scientist because I consider it more reliable. In my opinion, the idea of geomagic squares is more than a neologism—it is a true generalization. The best case for the significance of this generalization was made by Sallows himself who has said, "Traditional magic squares featuring numbers are then revealed as that particular case of 'geomagic' squares in which the elements are all one-dimensional." See Lee Sallows website for a more complete explanation of this point. — Foobarnix (talk) 05:09, 9 July 2011 (UTC)


The section on the first 5 and 6 order squares is repeated literally. make choice on where to delete (talk) 07:00, 6 December 2011 (UTC)

The section "Cultural Significance" is redundant and unreferenced: it should be removed. (talk) 10:05, 19 August 2012 (UTC) It is not certain that magic square have any significance that is not cultural, so this brief section 'cultural significance' was removed:

"Magic squares have fascinated humanity throughout the ages, and have been around for over 4,120 years[citation needed]. They are found in a number of cultures, including Egypt[citation needed] 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." (talk) 13:59, 2 October 2012 (UTC)

Related problems[edit]

Besides magic squares of primes, there is a longstanding unsolved problem relating a 3x3 magic square of perfect squares. The case 4x4 was solved by Euler in 1770. But please refer to for more magic square of squares examples.

Also note that shows a table of known multimagic squares, where a square with entries {s(a,b) with 1 <= a,b <= k} is n-multimagic if each square formed by {s(a,b)^i with 1 <= a,b <= k} is magic, for i = 1, ..., n. Bcurfs (talk) 00:55, 4 June 2012 (UTC)

Simple magic square[edit]

The page Simple magic square appears in WP:DUSTY and hasn't been edited since 2007 and is unreferenced. What do people think should happen to the article?--Salix (talk): 15:36, 30 September 2012 (UTC)

I would say that a merge is in order, with perhaps a slightly higher (earlier in the article) introduction of pandiagonal magic squares. The "simple" adjective doesn't add anything and I've never seen it used (but I am no authority on the subject). Bill Cherowitzo (talk) 17:30, 30 September 2012 (UTC)

Number of magic squares[edit]

I managed to calculate the number of 1x1, 2x2, ..., 5x5, etc. size magic squares. I believe that the number of 5x5 is incorrectly posted as 275,305,224. It should be 275,305,810 according to my formulas. If you'd like see the solutions, then please visit my website... I'm not trying to break any guidelines, just provide you with the correct answer. (talk) 18:07, 16 November 2012 (UTC)

According to OEIS, the number of 5×5 magic squares was calculated by Rich Schroeppel, but they don't give a reference. This suggests that the result is unpublished, and it's possible that Schroeppel made a mistake. Perhaps you could contact him and discuss it? —Mark Dominus (talk) 06:48, 17 November 2012 (UTC)
You might also want to check a more recent (Schroeppel's work dates to 1973) article which provides a generating function for the number of magic squares. Beck, Cohen, Cuomo and Gribelyuk, The number of "magic" squares, cubes and hypercubes, Amer. Math Monthly 110(2003), 707-717. Bill Cherowitzo (talk) 18:05, 17 November 2012 (UTC)
Other computations agree with Rich Schroeppel. A Google search on 275305224 "magic squares" program quickly found [3], [4], [5]. I haven't found other reports of your number so I suspect you have an error. Thousands of sources mention the accepted count. Your alternative count should not be mentioned in the article without being accepted by a serious peer-reviewed math journal. PrimeHunter (talk) 01:38, 18 November 2012 (UTC)
oh, ok... if all the (programs) agree, then I should doubt my formulas. NO! They all share the same algorithm; I have sent an e-mail to Rich. They reason that I contest his (count) is because, for n=4, 880 has the factor of 11 as does my algebraic formula, and that 11 comes from my generator function "portion". Richard's (computation) does NOT contain the factor 149 which clearly has to be present, since it's in my generator function "portion" for n=5. Our answers are too close not to suppose that Richard's isn't correct and mine could be... I'm 4 for 4... N= 1, 0, 1, 880, and I hope that I'm 5 for 5... N= 275,305,810. (talk) 02:53, 18 November 2012 (UTC)
I finally did confirm that Richard's computation was correct. It turned out that when 'n' is odd, I have to subract ((n-d)^2)*2^n from my calculation where n= (order) and d= (dimension). we agree at 275, 305, 224. (talk) 19:05, 3 March 2013 (UTC)

Modulo vs. times[edit]

I stand by my good faith changes to the section here on medjig method, and would like to undo the revert by Arthur Rubin (see below). My students here at Canisius College found the current discussion confusing, and helped me word my editing. Here is a summary:

The desired square is produced with entries x+9y, where x comes from an N x N square, and y comes from the solution to a medjig puzzle. Referring to "modulo" might be saying that once the desired square is produced, one can recover the x entries by working modulo 9. But it is confusing not to point out that x and y entries must first be found, with the y then multiplied by 9.

18:43, 17 April 2013‎ Arthur Rubin (talk | contribs)‎ . . (56,941 bytes) (-13)‎ . . (Reverted good faith edits by (talk): I'm not sure which explanation is more accurate (and/or sourced), but it is really is "modulo". (TW)) (undo) — Preceding unsigned comment added by (talk)

I'm still not sure which construction is more clear for the 6×6 square; I'm not qualified to do that, being a long-time mathematician. However, it really is modulo N^2, rather than times N^2. In fact, the latter is clearly wrong. — Arthur Rubin (talk) 18:58, 18 April 2013 (UTC)

Franklin's chess-knight 64-square[edit]

Anyone have any idea how Ben Franklin set up his 8x8 magic square in which a chess knight can jump from square 1 to square 64 in sequence? I've been wondering about this ever since I first saw the square--which doesn't seem to be in this article--at the age of 9. Thanks in advance! [signed] FLORIDA BRYAN — Preceding unsigned comment added by 2601:3:1000:5B1:9227:E4FF:FEF0:BBDE (talk) 20:42, 24 April 2014 (UTC)

Maybe it is covered at Knight's tour. All the best: Rich Farmbrough06:49, 29 April 2014 (UTC).