Skip to main content

The Mystery of Magic Squares

An animated exploration of magic squares.

A magic square is a n × n square grid (where n is the number of rows or columns) filled with distinct, positive integers such that the sum of each row, column, and diagonal is equal.

Too much? Let's make a quick 3×3 magic square. It's quite simple: you have to pick 3 numbers below — a, b, and c — while following these rules:

  • 1. a is an integer that must be greater than 0: (a > 0)
  • 2. b is an integer that must be greater than a (b > a), but it cannot equal 2 times a (b ≠ 2a)
  • 3. c is an integer such that (c − a) > b

This might seem a little complicated but I promise you'll get the hang of it in no time. A simple one has already been drawn for you. Click on Animate to watch the rows, columns, and diagonals add up to equal sums. Or enter in other numbers to draw your own magic square.

a
b
c

Most-Perfect Magic Square

A scrolly that walks through an interactive explanation of the Parshavnath temple magic square, also known as the Chautisa Yantra.

A most-perfect magic square is just a magic square that has a few more tricks up its sleeve. Like a normal magic square...

...the rows, columns, and diagonals all add up to the magic constant, which in this case is 34. But there's more...

The broken diagonals, illustrated in colour, also add up to 34! Magic squares with this property are called pan-diagonal magic squares, or panmagic for short.

Click on each coloured cell to sum them in the respective totals box below and see the magic for yourself.

But this is a most perfect magic square, so it doesn't end there. You can split the 4×4 square into four 2×2 squares, and — yup, you guessed it — it'll add up to 34. Try it!

You can even make funky alternating patterns, and it still refuses to not add up to 34...

After seeing all that this might seem a little boring... but, still 34.

You can move the squares around, cut them in half, and somehow, it will still add up to 36 — no, sorry — 34.

34 34 34 34. (We're coming to the end, I promise.)

Finally, last one (I think). Remember the four corners? This is the rest of it.