How to solve magic square using linear equations?
Answers
Magicians often include acts that are not strictly magic, but leave their audiences feeling that they have witnessed something impossible. Memory stunts, unusual scientific demonstrations, playing chess blindfolded and rapid mental mathematics are some examples.
Successful stunts of this kind suggest the performer has an enhanced talent. In some cases, this is true – they may have an extraordinary memory or be a chess grandmaster. But in most cases the performer is using a system. These systems can be simple, or can require tremendous skill – but they are still easier than doing the stunt without any system at all.
A popular mathematical stunt is to create a “magic square”. This is a grid, most commonly 3x3 or 4x4, filled with numbers. The numbers in every row add up to the same number. Here is an example:
As you can see all the rows add up to 15. Notice that each number from 1 to 9 is used once. If you could repeat numbers, many magic squares would become trivially easy, like a grid made entirely of 1s that added up to 3!
There’s nothing amazing about that.
Making a magic square before an audience, if done properly, can be an impressive demonstration of one’s apparent command of higher-level mathematics. I’ll show you how to do this, using a seemingly more difficult 4x4 grid.
Take a business card and write this 4x4 magic square on the back:
This magic square adds up to 34. This is the smallest sum possible using the numbers 1 to 16. Keep this card and you’ll be able to perform this stunt any time you wish.
After dinner, say, turn the conversation towards numbers and bring out your business card. Explain the basic idea behind a magic square; that every column and row adds up to the same number. Let your companions verify this if they wish by adding the columns and rows.
Tell them you’ll try and make a magic square just for them. Ask them to give you any two-digit number higher than 34.
Let’s assume they give you the number 87. Leave your business card where you can see it and bring out another piece of paper. Draw a 4x4 grid. From the target number that your guests named, subtract the number 34. In our example 87 is the target number: 87 minus 34 = 53. You then divide 53 by 4, to the nearest whole number. That gives 13 with a remainder of 1 (13 x 4 = 52; 52 + 1 = 53).
Remember the number 13. We call that the quotient, and it’s one of two special numbers you’ll need. The other special number is the quotient plus the remainder. In our case, that’s 14 (13 + 1).
Now you’re set. Begin by stealing a glance at your business card. Look at the top row. Add your first special number to the 8 that appears in row 1, column 1 of your card: 13 + 8 = 21. Write this down in the corresponding box on your new grid.
You will continue on like this for all 16 spaces in the grid, with four exceptions. When you get to the numbers 13, 14, 15 or 16 on your original card, you have to add the special number plus the remainder.
The correctly filled grid will look like this:
Notice that each result in this grid is simply the number from your original business card added to 13, with the exception of the four numbers in red. These are your original numbers plus 14.
You can now show that every row and column adds up to 87.
But wait, there’s more! You also managed to get the two diagonals to add up to 87, as well as the four numbers in each of the corner quadrants …
… and the top centre and lower centre quadrants!
Unfortunately, the two side quadrants will not add to 87 but the four corners of the large grid will!
The truth is, the diagonals, quadrants and the four corners added up to 34 on your original business card too, but don’t reveal this beforehand. Save that for the magic square that you make for your guests.
Because 87 is an odd number, we had a remainder that we needed to use for the boxes with 13, 14, 15 and 16 in them. If your spectator names an even number (such as 54) you won’t have any remainder.
Remember the equation: 54 (the target number) minus 34 (our original magic square total) = 20. And then you divide 20 by 4 to get 5 with no remainder! All you have to do is add 5 to each of the 16 numbers in your new grid and it will work.
Incidentally, if your target number is even, then those two side quadrants will also add up to the target number.
If you want to make this look tougher, you can memorise your original magic square that adds up to 34. That way you don’t have to look at your crib sheet. Also, instead of working straight across the rows one at a time, you can ask your spectator to point to any empty box and you can add your special number (or special number plus remainder) to whatever number belongs in that box.
You’re now well on your way to being a mathematical genius! BYO business card.
This article appeared in Cosmos 66 - Dec-Jan 2016 under the headline "Magic by the numbers"