How-to

How to do the magic square trick

Build a 4×4 magic square for any number someone names, with every row, column and diagonal adding up, using one simple subtraction.

By The Online Magic Store

· 4 min read

a vintage clock face with hands frozen, dark background
In this story 8 sections
  1. What does the audience see
  2. How does the magic square work
  3. How do you do the magic square trick
  4. Where do magic squares come from
  5. How do you make it look better
  6. What are the common mistakes
  7. What helps you take it further
  8. Frequently asked questions

In the magic square trick, someone names any number and you quickly fill a 4×4 grid in which every row, column and diagonal adds up to it. The secret is a grid of twelve fixed numbers, plus four squares you work out with simple subtraction. If you can take 20 away from a number, you can do this trick.

What does the audience see?

You draw an empty 4×4 grid and ask someone for a number, say 45. Without stopping to think, you fill the sixteen squares. Then you ask them to add up any row. It comes to 45. So does every other row, every column and both diagonals. The four corners add up to 45 too, and so do the four squares in the middle.

It looks like serious mental arithmetic, which is exactly why it’s fun. It sits nicely alongside number tricks like the 1089 trick.

How does the magic square work?

Twelve squares in the grid always hold the same small numbers. Each row and column already has three of them, and they are arranged so that each line is a fixed amount short of the target. The four remaining squares hold the target number minus 18, 19, 20 or 21, which fills each line exactly.

Here is the grid with N standing for the number you’re given:

N − 20 1 12 7
11 8 N − 21 2
5 10 3 N − 18
4 N − 19 6 9

Check the top row: 1 + 12 + 7 = 20, and the first square is N − 20, so the row comes to N. The second row’s fixed numbers make 21, the third row’s make 18, and the bottom row’s make 19. The columns and diagonals are built the same way.

How do you do the magic square trick?

  1. Learn the grid. Memorize the twelve fixed numbers and where the four special squares sit. Or draw the fixed numbers lightly in pencil beforehand, small enough that only you can see them.
  2. Ask for a number. A number between 34 and 99 works best. Below 34, some squares repeat numbers, which still adds up but looks less impressive.
  3. Work out the root. Take 20 from their number. For 45, that’s 25. The other three special squares are one more (26), two more (27) and one less (24).
  4. Fill the grid out of order. Don’t go row by row. Jump around the grid so it looks like you’re juggling hard sums.
  5. Let them check. Hand over the pad and let them add the rows, columns and diagonals. Write each total around the edge as they go.

For 45 the finished grid reads 25, 1, 12, 7 / 11, 8, 24, 2 / 5, 10, 3, 27 / 4, 26, 6, 9.

Where do magic squares come from?

Magic squares have a long history of their own. W. W. Rouse Ball gives a whole chapter to their history and construction in Mathematical Recreations and Essays, first published in 1892, and it’s free in our public-domain library.

The quick “any number” version taught here is a performer’s shortcut. We haven’t found a reliable source for who first used it, so we won’t name one.

How do you make it look better?

  • Make the number personal. Ask for a number that means something to them, as long as it is above 33.
  • Show off the extras. Point out that the corners and the middle four add up as well. Each of the four 2×2 corner blocks does too.
  • Write with confidence. Speed sells it. Practise until you can fill the grid in under a minute.
  • Sign it. Give them the paper to keep. It’s a souvenir that proves something strange happened.

What are the common mistakes?

  • Mixing up the four special squares. Remember the pattern by row: minus 20, minus 21, minus 18, minus 19.
  • Filling it in order. Row by row makes the pattern easy to spot. Jump around.
  • Doing it twice. The fixed numbers stay the same, so a second grid for the same audience gives the secret away.
  • Accepting a small number. Under 34 you get repeats. Ask for a two-digit number above 33.

For another self-working number trick, try the magic number nine trick, or browse our easy mentalism collection.

What helps you take it further?

  • Mathematical Recreations and Essays by W. W. Rouse Ball, free from our public-domain library. Besides magic squares, it covers arithmetical card tricks, calculating prodigies and much more.
  • The Ultimate Puzzle by TCC, inspired by Winston Freer. Pieces are removed from a wooden frame puzzle, yet the rest still form a perfect rectangle. It is based on mathematical principles, with no palming, stealing or switching.

Frequently asked questions

What number should I ask for?

A number between 34 and 99 works best. Below 34 some squares repeat, which still adds up but looks less impressive.

Do I need to be good at maths?

No. The only sum you do is taking 20 away from the number, then adding or taking away one or two.

Which lines add up to the number?

Every row, every column and both diagonals. The four corners, the middle four squares and each 2×2 corner block also add up to it.

Can I write the fixed numbers in advance?

Yes. Draw them lightly in pencil before you start, so you only need to add the four special squares during the trick.