Recreational Mathematics > Magic Figures > Magic Squares >
Foundations of Mathematics > Mathematical Problems > Unsolved Problems >
Algebra > Linear Algebra > Matrices > Matrix Types >
Interactive Entries > Interactive Demonstrations >
A magic square is a square array of numbers consisting of the distinct positive integers 1, 2, ..., arranged such that the sum of the numbers in any horizontal, vertical, or main diagonal line is always the same number (Kraitchik 1942, p. 142; Andrews 1960, p. 1; Gardner 1961, p. 130; Madachy 1979, p. 84; Benson and Jacoby 1981, p. 3; Ball and Coxeter 1987, p. 193), known as the magic constant
If every number in a magic square is subtracted from , another magic square is obtained called the complementary magic square. A square consisting of consecutive numbers starting with 1 is sometimes known as a "normal" magic square.
The unique normal square of order three was known to the ancient Chinese, who called it the Lo Shu. A version of the order-4 magic square with the numbers 15 and 14 in adjacent middle columns in the bottom row is called Dürer's magic square. Magic squares of order 3 through 8 are shown above.
The magic constant for an th order general magic square starting with an integer and with entries in an increasing arithmetic series with difference between terms is
(Hunter and Madachy 1975).
It is an unsolved problem to determine the number of magic squares of an arbitrary order, but the number of distinct magic squares (excluding those obtained by rotation and reflection) of order , 2, ... are 1, 0, 1, 880, 275305224, ... (OEIS A006052; Madachy 1979, p. 87). The 880 squares of order four were enumerated by Frénicle de Bessy in 1693, and are illustrated in Berlekamp et al. (1982, pp. 778-783). The number of magic squares was computed by R. Schroeppel in 1973. The number of squares is not known, but Pinn and Wieczerkowski (1998) estimated it to be using Monte Carlo simulation and methods from statistical mechanics. Methods for enumerating magic squares are discussed by Berlekamp et al. (1982) and on the MathPages website.
A square that fails to be magic only because one or both of the main diagonal sums do not equal the magic constant is called a semimagic square. If all diagonals (including those obtained by wrapping around) of a magic square sum to the magic constant, the square is said to be a panmagic square (also called a diabolic square or pandiagonal square). If replacing each number by its square produces another magic square, the square is said to be a bimagic square (or doubly magic square). If a square is magic for , , and , it is called a trimagic square (or trebly magic square). If all pairs of numbers symmetrically opposite the center sum to , the square is said to be an associative magic square.
Squares that are magic under multiplication instead of addition can be constructed and are known as multiplication magic squares. In addition, squares that are magic under both addition and multiplication can be constructed and are known as addition-multiplication magic squares (Hunter and Madachy 1975).
Kraitchik (1942) gives general techniques of constructing even and odd squares of order . For odd, a very straightforward technique known as the Siamese method can be used, as illustrated above (Kraitchik 1942, pp. 148-149). It begins by placing a 1 in the center square of the top row, then incrementally placing subsequent numbers in the square one unit above and to the right. The counting is wrapped around, so that falling off the top returns on the bottom and falling off the right returns on the left. When a square is encountered that is already filled, the next number is instead placed below the previous one and the method continues as before. The method, also called de la Loubere's method, is purported to have been first reported in the West when de la Loubere returned to France after serving as ambassador to Siam.
A generalization of this method uses an "ordinary vector" that gives the offset for each noncolliding move and a "break vector" that gives the offset to introduce upon a collision. The standard Siamese method therefore has ordinary vector (1, and break vector (0, 1). In order for this to produce a magic square, each break move must end up on an unfilled cell. Special classes of magic squares can be constructed by considering the absolute sums , , , and . Call the set of these numbers the sumdiffs (sums and differences). If all sumdiffs are relatively prime to and the square is a magic square, then the square is also a panmagic square. This theory originated with de la Hire. The following table gives the sumdiffs for particular choices of ordinary and break vectors.
|ordinary vector||break vector||sumdiffs||magic squares||panmagic squares|
|(1, )||(0, 1)||(1, 3)||none|
|(1, )||(0, 2)||(0, 2)||none|
|(2, 1)||(1, )||(1, 2, 3, 4)||none|
|(2, 1)||(1, )||(0, 1, 2, 3)|
|(2, 1)||(1, 0)||(0, 1, 2)||none|
|(2, 1)||(1, 2)||(0, 1, 2, 3)||none|
A second method for generating magic squares of odd order has been discussed by J. H. Conway under the name of the "lozenge" method. As illustrated above, in this method, the odd numbers are built up along diagonal lines in the shape of a diamond in the central part of the square. The even numbers that were missed are then added sequentially along the continuation of the diagonal obtained by wrapping around the square until the wrapped diagonal reaches its initial point. In the above square, the first diagonal therefore fills in 1, 3, 5, 2, 4, the second diagonal fills in 7, 9, 6, 8, 10, and so on.
An elegant method for constructing magic squares of doubly even order is to draw s through each subsquare and fill all squares in sequence. Then replace each entry on a crossed-off diagonal by or, equivalently, reverse the order of the crossed-out entries. Thus in the above example for , the crossed-out numbers are originally 1, 4, ..., 61, 64, so entry 1 is replaced with 64, 4 with 61, etc.
A very elegant method for constructing magic squares of singly even order with (there is no magic square of order 2) is due to J. H. Conway, who calls it the "LUX" method. Create an array consisting of rows of s, 1 row of Us, and rows of s, all of length . Interchange the middle U with the L above it. Now generate the magic square of order using the Siamese method centered on the array of letters (starting in the center square of the top row), but fill each set of four squares surrounding a letter sequentially according to the order prescribed by the letter. That order is illustrated on the left side of the above figure, and the completed square is illustrated to the right. The "shapes" of the letters L, U, and X naturally suggest the filling order, hence the name of the algorithm.
Variations on magic squares can also be constructed using letters (either in defining the square or as entries in it), such as the alphamagic square and templar magic square.
Various numerological properties have also been associated with magic squares. Pivari associates the squares illustrated above with Saturn, Jupiter, Mars, the Sun, Venus, Mercury, and the Moon, respectively. Attractive patterns are obtained by connecting consecutive numbers in each of the squares (with the exception of the Sun magic square).
Abe, G. "Unsolved Problems on Magic Squares." Disc. Math.127, 3-13, 1994.
Alejandre, S. "Suzanne Alejandre's Magic Squares." http://mathforum.org/alejandre/magic.square.html.
Andrews, W. S. Magic Squares and Cubes, 2nd rev. ed. New York: Dover, 1960.
Andrews, W. S. and Sayles, H. A. "Magic Squares Made with Prime Numbers to have the Lowest Possible Summations." Monist23, 623-630, 1913.
Ball, W. W. R. and Coxeter, H. S. M. "Magic Squares." Ch. 7 in Mathematical Recreations and Essays, 13th ed. New York: Dover, 1987.
Barnard, F. A. P. "Theory of Magic Squares and Cubes." Memoirs Natl. Acad. Sci.4, 209-270, 1888.
Benson, W. H. and Jacoby, O. Magic Cubes: New Recreations. New York: Dover, 1981.
Benson, W. H. and Jacoby, O. New Recreations with Magic Squares. New York: Dover, 1976.
Berlekamp, E. R.; Conway, J. H; and Guy, R. K. Winning Ways for Your Mathematical Plays, Vol. 2: Games in Particular. London: Academic Press, 1982.
Chabert, J.-L. (Ed.). "Magic Squares." Ch. 2 in A History of Algorithms: From the Pebble to the Microchip. New York: Springer-Verlag, pp. 49-81, 1999.
Danielsson, H. "Magic Squares." http://www.magic-squares.de/magic.html.
Flannery, S. and Flannery, D. In Code: A Mathematical Journey. London: Profile Books, pp. 16-24, 2000.
Frénicle de Bessy, B. "Des quarrez ou tables magiques. Avec table generale des quarrez magiques de quatre de costé." In Divers Ouvrages de Mathématique et de Physique, par Messieurs de l'Académie Royale des Sciences (Ed. P. de la Hire). Paris: De l'imprimerie Royale par Jean Anisson, pp. 423-507, 1693. Reprinted as Mem. de l'Acad. Roy. des Sciences5 (pour 1666-1699), 209-354, 1729.
Fults, J. L. Magic Squares. Chicago, IL: Open Court, 1974.
Gardner, M. "Magic Squares." Ch. 12 in The Second Scientific American Book of Mathematical Puzzles & Diversions: A New Selection. New York: Simon and Schuster, pp. 130-140, 1961.
Gardner, M. "Magic Squares and Cubes." Ch. 17 in Time Travel and Other Mathematical Bewilderments. New York: W. H. Freeman, pp. 213-225, 1988.
Grogono, A. W. "Magic Squares by Grog." http://www.grogono.com/magic/.
Hawley, D. "Magic Squares." http://www.nrich.maths.org.uk/mathsf/journalf/aug98/art1/.
Heinz, H. "Downloads." http://www.magic-squares.net/downloads.htm.
Heinz, H. "Magic Squares." http://www.magic-squares.net/magicsquare.htm.
Heinz, H. and Hendricks, J. R. Magic Square Lexicon: Illustrated. Self-published, 2001. http://www.magic-squares.net/BookSale.htm.
Hirayama, A. and Abe, G. Researches in Magic Squares. Osaka, Japan: Osaka Kyoikutosho, 1983.
Horner, J. "On the Algebra of Magic Squares, I., II., and III." Quart. J. Pure Appl. Math.11, 57-65, 123-131, and 213-224, 1871.
Hunter, J. A. H. and Madachy, J. S. "Mystic Arrays." Ch. 3 in Mathematical Diversions. New York: Dover, pp. 23-34, 1975.
Kanada, Y. "Magic Square Page." http://www.kanadas.com/puzzles/magic-square.html.
Kraitchik, M. "Magic Squares." Ch. 7 in Mathematical Recreations. New York: Norton, pp. 142-192, 1942.
Lei, A. "Magic Square, Cube, Hypercube." http://www.cs.ust.hk/~philipl/magic/
Madachy, J. S. "Magic and Antimagic Squares." Ch. 4 in Madachy's Mathematical Recreations. New York: Dover, pp. 85-113, 1979.
MathPages. "Solving Magic Squares." http://www.mathpages.com/home/kmath295.htm.
Moran, J. The Wonders of Magic Squares. New York: Vintage, 1982.
Pappas, T. "Magic Squares," "The 'Special' Magic Square," "The Pyramid Method for Making Magic Squares," "Ancient Tibetan Magic Square," "Magic 'Line.'," and "A Chinese Magic Square." The Joy of Mathematics. San Carlos, CA: Wide World Publ./Tetra, pp. 82-87, 112, 133, 169, and 179, 1989.
Peterson, I. "Ivar Peterson's MathLand: More than Magic Squares." http://www.maa.org/mathland/mathland_10_14.html.
Pickover, C. A. The Zen of Magic Squares, Circles, and Stars: An Exhibition of Surprising Structures Across Dimensions. Princeton, NJ: Princeton University Press, 2002.
Pinn, K. and Wieczerkowski, C. "Number of Magic Squares from Parallel Tempering Monte Carlo." Int. J. Mod. Phys. C9, 541-547, 1998. http://arxiv.org/abs/cond-mat/9804109.
Pivari, F. "Nice Examples." http://www.geocities.com/CapeCanaveral/Lab/3469/examples.html.
Pivari, F. "Create Your Magic Square." http://www.pivari.com/squaremaker.html.
Sloane, N. J. A. Sequence A006052/M5482 in "The On-Line Encyclopedia of Integer Sequences."
Suzuki, M. "Magic Squares." http://mathforum.org/te/exchange/hosted/suzuki/MagicSquare.html.
Weisstein, E. W. "Books about Magic Squares." http://www.ericweisstein.com/encyclopedias/books/MagicSquares.html.
Wells, D. The Penguin Dictionary of Curious and Interesting Numbers. Middlesex, England: Penguin Books, p. 75, 1986.Referenced on Wolfram|Alpha: Magic SquareCITE THIS AS:
Weisstein, Eric W. "Magic Square." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/MagicSquare.html
Wolfram Web Resources
The #1 tool for creating Demonstrations and anything technical.
Explore anything with the first computational knowledge engine.
|Wolfram Demonstrations Project »|
Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.
Join the initiative for modernizing math education.
|Online Integral Calculator »|
Solve integrals with Wolfram|Alpha.
|Step-by-step Solutions »|
Walk through homework problems step-by-step from beginning to end. Hints help you try the next step on your own.
|Wolfram Problem Generator »|
Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.
|Wolfram Education Portal »|
Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more.
|Wolfram Language »|
Knowledge-based programming for everyone.
I didn't like abstract algebra as an undergrad. Now I love it! Textbooks that seem pleasant now seemed dry as dust back then. So, I'm not confident that I could recommend an all-around textbook on algebra that my earlier self would have enjoyed. But, I would have liked these:
- Hermann Weyl, Symmetry, Princeton University Press, Princeton, New Jersey, 1983. (Before diving into group theory, find out why it's fun.)
- Ian Stewart, Galois Theory, 3rd edition, Chapman and Hall, New York, 2004. (A fun-filled introduction to a wonderful application of group theory that's often explained very badly.)
Next, here are some books on topics related to mathematical physics. Out of laziness, I'll assume you're already somewhat comfortable with the topics listed above - yes, I know that requires about 4 years of full-time work! - and I'll pick up from there. Here's a good place to start:
- Paul Bamberg and Shlomo Sternberg, A Course of Mathematics for Students of Physics, Cambridge University, Cambridge, 1982. (A good basic introduction to modern math, actually.)
- Robert Geroch, Mathematical Physics, University of Chicago Press, Chicago, 1985.
- Yvonne Choquet-Bruhat, Cecile DeWitt-Morette, and Margaret Dillard-Bleick, Analysis, Manifolds, and Physics (2 volumes), North-Holland, 1982 and 1989.
Here are my favorite books on various special topics:
Group theory in physics:
- Shlomo Sternberg, Group Theory and Physics, Cambridge University Press, 1994.
- Robert Hermann, Lie Groups for Physicists, Benjamin-Cummings, 1966.
- George Mackey, Unitary Group Representations in Physics, Probability, and Number Theory, Addison-Wesley, Redwood City, California, 1989.
Lie groups, Lie algebras and their representations - in rough order of increasing sophistication:
- Brian Hall, Lie Groups, Lie Algebras, and Representations, Springer Verlag, Berlin, 2003.
- William Fulton and Joe Harris, Representation Theory - a First Course, Springer Verlag, Berlin, 1991. (A friendly introduction to finite groups, Lie groups, Lie algebras and their representations, including the classification of simple Lie algebras. One great thing is that it has lots of pictures of root systems, and works slowly up a ladder of examples of these before blasting the reader with abstract generalities.)
- J. Frank Adams, Lectures on Lie Groups, University of Chicago Press, Chicago, 2004. (A very elegant introduction to the theory of semisimple Lie groups and their representations, without the morass of notation that tends to plague this subject. But it's a bit terse, so you may need to look at other books to see what's really going on in here!)
- Daniel Bump, Lie Groups, Springer Verlag, Berlin, 2004. (A friendly tour of the vast and fascinating panorama of mathematics surrounding groups, starting from really basic stuff and working on up to advanced topics. The nice thing is that it explains stuff without feeling the need to prove every statement, so it can cover more territory.)
Geometry and topology for physicists - in rough order of increasing sophistication:
- Gregory L. Naber, Topology, Geometry and Gauge Fields: Foundations, Springer Verlag, Berlin, 1997.
- Chris Isham, Modern Differential Geometry for Physicists, World Scientific Press, Singapore, 1999. (Isham is an expert on general relativity so this is especially good if you want to study that.)
- Harley Flanders, Differential Forms with Applications to the Physical Sciences, Dover, New York, 1989. (Everyone has to learn differential forms eventually, and this is a pretty good place to do it.)
- Charles Nash and Siddhartha Sen, Topology and Geometry for Physicists, Academic Press, 1983. (This emphasizes the physics motivations... it's not quite as precise at points.)
- Mikio Nakahara, Geometry, Topology, and Physics, A. Hilger, New York, 1990. (More advanced.)
- Charles Nash, Differential Topology and Quantum Field Theory, Academic Press, 1991. (Still more advanced - essential if you want to understand what Witten is up to.)
Geometry and topology, straight up:
- Victor Guillemin and Alan Pollack, Differential Topology, Prentice-Hall, Englewood Cliffs, 1974.
- B.A. Dubrovin, A.T. Fomenko, and S.P. Novikov, Modern Geometry - Methods and Applications, 3 volumes, Springer Verlag, Berlin, 1990. (Lots of examples, great for building intuition, some mistakes here and there. The third volume is an excellent course on algebraic topology from a geometrical viewpoint.)
- Louis Kauffman, On Knots, Princeton U. Press, Princeton, 1987.
- Louis Kauffman, Knots and Physics, World Scientific, Singapore, 1991.
- Dale Rolfsen, Knots and Links, Publish or Perish, Berkeley, 1976.
Geometrical aspects of classical mechanics:
- V. I. Arnold, Mathematical Methods of Classical Mechanics, translated by K. Vogtmann and A. Weinstein, 2nd edition, Springer-Verlag, Berlin, 1989. (The appendices are somewhat more advanced and cover all sorts of nifty topics.)
Analysis and its applications to quantum physics:
- Michael Reed and Barry Simon, Methods of Modern Mathematical Physics (4 volumes), Academic Press, 1980.
- Joseph Rotman, An Introduction to Homological Algebra, Academic Press, New York, 1979. (A good introduction to an important but sometimes intimidating branch of math.)
- Charles Weibel, An Introduction to Homological Algebra, Cambridge U. Press, Cambridge, 1994. (Despite having the same title as the previous book, this goes into many more advanced topics.)
- Tom Leinster, Basic Category Theory, Cambridge Studies in Advanced Mathematics, Vol. 143, Cambridge University Press, 2014. Also available for free on the arXiv. (A introduction for beginners that focuses on three key concepts and how they're related: adjoint functor, representable functors, and limits.)
- Emily Riehl, Category Theory in Context, Dover, New York, 2016. Also available for free on her website. (More advanced. As the title suggests, this gives lots of examples of how category theory is applied to other subjects in math.)
I have always imagined that Paradise will be a kind of library. - Jorge Luis Borges
© 2016 John Baez