Make a New Magic Square
Magic 66 Square
The above is what I call a Semi-Perfect Magic Square see definitions below
Scroll down for step-by-step directions about |
If this information and this web page are useful to you,
please send a donation to the author.
Thank you in advance ... click here for details.
As you pick your random numbers, watch out for duplicate numbers. While a square with duplicate numbers is still magic, most people prefer their magic squares to contain all different numbers. If you allow some numbers to be negative, you'll have more choices as you create your square. We will allow negative numbers for examples you see on this page (though they won't always appear, because every time you load this page, I'm generating new random numbers).
If you are using a calculator, you might find it easier to simply subtract three numbers from the magic sum each time you see that you have three numbers in a row, column or diagonal, rather than learn the shortcuts.I wrote this page to explain these various shortcuts, because many people find it easier to add two numbers and subtract one in their head rather than subtract three numbers in their head.
There are simple 4x4 magic squares, and there are 4x4 magic squares that have varying levels of perfection. For simplicity, I am calling them:
- Simple Magic Square: every row, every column, both diagonals, the four outside corners, and the four inside numbers, all add up to the magic sum;
- Magic Square with Magic Quadrants: each of the four quadrants (top left, top right, bottom left, bottom right) also add up to the magic sum. In addition, I'm fairly sure that you should always be able to move the top two rows down to the bottom, and still have a magic square; or move the left two columns over to the right and still have a magic square.
- Semi-Perfect Magic Square: the top-middle and the bottom-middle 2x2 set of numbers also add up to the magic sum. In addition, you can move the top two rows down to the bottom, and still have a magic square; or move the left two columns over to the right and still have a magic square.
- Perfectly Perfect Magic Square: every 2x2 block of numbers in the magic square also adds up to the same magic sum. In addition, the perfectly perfect magic square has the property that you can manipulate the square one row or column at a time to make new squares that are also perfectly perfect (remove a row from the top, put it on the bottom, it's still perfect, but with a different arrangement of the same 16 numbers). (I'm 99.44% certain that only even magic sums are possible with perfectly perfect magic squares.)
For purposes of this demonstration, we will restrict our sums to values between 30 and 999, but this method should work, on paper, with smaller sums and negative sums, as long as you watch out for duplicate numbers.
For this example, we will use 66 as our Magic Sum.
Pick random numbers for three of the corners:
| 10 | 12 | ||
| 40 |
Add the numbers you just put into the three corners: 10+12+40=62
Subtract this value from the Magic Sum to get the number for the fourth corner: 66-62=4If your goal is to make a Perfectly-Perfect magic square, you should probably try to use corner numbers where:
10 12 4 40 * the top row sum (so far) is not equal to the bottom row sum
* the first column sum (so far) is not equal to the fourth column sum
* two of the numbers should be less than one-fourth the magic sum, and the other two numbers should be more than that value (though this rule is not firm, just helpful), and
* the two smaller numbers should usually be on one diagonal while the two larger numbers should usually be on the larger diagonal (this is also not a firm rule, there are exceptions). * and be sure that you don't try to make a perfectly perfect magic square with an odd magic sum. I've experimentally proved that odd magic sums are impossible in a perfectly-perfect square, though I'm not 100% certain, but I am 99 and 44/100% certain. (people of my generation will recognize where that number comes from.)
If you are making a simple magic square or a magic square with magic quadrants, pick a random number and put it into the second box in the second row:If you are making a semi-perfect magic square, you will need to plan ahead, because you want the sum of the two corners in the first row to match the sum of the two inside numbers in the second row.
If you are making a perfectly-perfect magic square, you also want the sum of the two corners in the first column to be the same as the sum of the two inside numbers in the second column. This can be VERY HARD to do at times, and might require going back to try other numbers in the corners.
| 10 | 12 | ||
| 3 | |||
| 4 | 40 |
Add the two corner numbers (that are not in the diagonal you are working on). (12+4=16).
Subtract number you just put into the square from that sum. (16-3=13).
| 10 | 12 | ||
| 3 | |||
| 13 | |||
| 4 | 40 |
There is a harder method that you can use to finish the diagonals, rows and columns
If you prefer, whenever you have three numbers in one row, column or diagonal, you may subtract those three numbers from the magic sum to get the fourth number. For example: 66 - 10 - 3 - 40 = 13Audience Participation? If you're using our method of creating magic squares as a parlor trick, you could invite an audience member to calculate this fourth number for you on paper, but since you used the easy method to know that number, your mind can be working ahead on the next numbers while he's figuring. Of course, if you have audience help, you definitely need to know the number in order to make sure they don't give you a wrong answer.
If you are making a Simple or a Quadrant magic square, just pick a random number and put it into the third box in the second row:If you are making a Semi-Perfect or a Perfectly-Perfect magic square, you need to pick a number for the third position in the second row such that the sum of the two corners in the first row is equal to the sum of the middle numbers in the second row. For example, add the numbers in the top corners: 10+12=22, then subtract the number in the second row second column from that sum to get the value for the third position in the second row: 22-3=19.
| 10 | 12 | ||
| 3 | 19 | ||
| 13 | |||
| 4 | 40 |
Add the two corner numbers (that are not in the diagonal you are working on). (10+40=50).
Subtract number you just put into the square from that sum. (50-19=31)
10 12 3 19 31 13 4 40 If you are making a Perfectly-Perfect Magic Square, you need verify that the sum of the two corner numbers in the first column is equal to the sum of the two middle numbers in the second column.
If the sums of the first two columns are equal, you may continue to make your magic square. It will come out perfectly perfect.
If the sums are not equal, you need to decide to either 1) go back and try again, or 2) go forward and only have a semi-perfect magic square. (Remember, I'm 99.44% certain that odd sums are NOT possible in perfectly-perfect squares.)
Let's look at the perfectly-perfect magic square that happens to be shown as an example of a magic square in Webster's Third New International Dictionary Unabridged. And over to the right, let's look at a semi-perfect magic square with the magic sum of 49. (Remember, it's impossible to make a perfectly-perfect magic square with an odd magic sum):
Perfectly-Perfect
15 19 15 19 6 3 10 15 9 16 5 4 7 2 11 14 12 13 8 1 19 15 19 15 Semi-Perfect
25 24 25 24 22 5 18 4 3 19 7 20 1 15 8 25 23 10 16 0 24 25 24 25 Did you notice that the sums of the numbers in the top two rows alternate going across the top, and the same sums alternate going back in the bottom two rows? And if you are making a perfectly-perfect magic square, there will be a different pair of sums that alternate, going down looking at the first two columns, and going up looking at the last two columns. We can use this trick for planning ahead, and for making our calculations easier.
What this means is that BEFORE you pick your first number, which will make every other number fall into place, you can pick two partial sums in your head, two partial sums that add up to your magic sum, and test them by subtracting each existing number in your partially filled in square from each number to see if you'll have a duplicate. If you don't, then you are ready to write your first number.
Scroll down if you wish to make a simple magic square or a magic square with magic quadrants (or you could just decide to make a semi-perfect square and follow these directions, they really are simpler for most people).Pick two numbers that add up to your magic sum, 66. For example, 58 and 8.
Imagine that you have put these numbers alternating across the top of your partial magic square, and alternating back along the bottom:
58 8 58 8 10 12 3 19 31 13 4 40 8 58 8 58 Before you write anything down, test these numbers in your head to see if any of the subtracted numbers are duplicates. If they are, simply add one and subtract one to your partial sums and try again. Once you find no duplicates, start writing your first number and the rest will fall into place. I'll leave it for you to finish the subtractions, then scroll down to compare your square to mine.
Plan Ahead: If you are making a semi-perfect or a perfectly-perfect magic square, you can plan ahead before you pick your random number.Put a random number into the bottom box in the second column
| 10 | 12 | ||
| 3 | 19 | ||
| 31 | 13 | ||
| 4 | 27 | 40 |
The sum of the top and bottom numbers in the second column must be equal to the sum of the two middle squares in the third column, so our shortcut here is toAdd the middle numbers in the third column: 19+13=32
Subtract your latest number from that sum to get the remaining number for the second column: 32-27=5
| 10 | 5 | 12 | |
| 3 | 19 | ||
| 31 | 13 | ||
| 4 | 27 | 40 |
The sum of the two middle numbers in the bottom row must be equal to the sum of the two corner numbers in the top row, so we can use another shortcut:Add the corner numbers in the top row: 10+12=22
Subtract the second number in the bottom row from that sum to get the remaining number for the bottom row: 22-27=-5
| 10 | 5 | 12 | |
| 3 | 19 | ||
| 31 | 13 | ||
| 4 | 27 | -5 | 40 |
You guessed it ... the sum of the two middle numbers in the top row must be equal to the sum of the two corner numbers in the bottom row, so we have another shortcut:Add the corner numbers in the bottom row: 4+40=44
Subtract second number in the top row from that sum to get the remaining number for the top row: 44-5=39
| 10 | 5 | 39 | 12 |
| 3 | 19 | ||
| 31 | 13 | ||
| 4 | 27 | -5 | 40 |
Here, we need to ask a simple question: Are we making a simple magic square, or a square that has some level of perfection to it? Simple Magic Square: If we are making the simplest square, you can put any random number into the fourth box in the second row.Any kind of Perfect Square: If we are making a magic square that has any level of perfection to it, we need to calculate the value of the number that will go into the fourth box in the second row:
Look at the top-right quadrant of what we've done so far. Subtract the other three numbers from the magic sum, and put the result into the remaining square in the quadrant.NOTE: If you want to make a Magic Square that also has Magic Quadrants, a magic square in which the four numbers in each quadrant of the magic square also add up to the same magic sum, you should not pick a random number. Instead, subtract the other three numbers in the top right quadrant from the magic sum, and put that value into the fourth box in the second row.
10 5 39 12 3 19 29 31 13 4 27 -5 40 The sum of the outer numbers in the second row must be equal to the sum of the inner numbers in the third row, so we can use another shortcut:
Add the middle numbers in the third row: 31+13=44
Subtract the last number in the second row from that sum to get the remaining number for the second row: 44-29=15
10 5 39 12 15 3 19 29 31 13 4 27 -5 40 The sum of the inner numbers in the first column must equal the sum of the outer numbers in the fourth column, so here comes another shortcut:
Add the outer numbers in the fourth column: 12+40=52
Subtract the second number in the first column from that sum to get the remaining number for the first column: 52-15=37
10 5 39 12 15 3 19 29 37 31 13 4 27 -5 40 The sum of the inner numbers in the fourth column must equal the sum of the outer numbers in the first column, so here's our last shortcut:
Add the outer numbers in the first column: 10+4=14
Subtract the second number in the fourth column from that sum to get the remaining number for that column: 14-29=-15
| 10 | 5 | 39 | 12 |
| 15 | 3 | 19 | 29 |
| 37 | 31 | 13 | -15 |
| 4 | 27 | -5 | 40 |
At every step of the way, you should have been watching out for duplicate numbers. It should be easy to avoid duplicate numbers when you are working on the corners and the diagonals, because there are so many available numbers.However, once you get to doing the outer numbers in the middle rows and middle columns, it gets a bit more involved, because if you change one number, you must change three other numbers.
Here's a trick you can use to tweak outer numbers in the middle rows or columns:
Let's look at our magic square again:
10 5 39 12 15 3 19 29 37 31 13 -15 4 27 -5 40 If you saw a duplicate number in one of the shaded squares, you could simply
pick a constant (like 1, 2, 20 or 30 or whatever)The same trick will work on the middle two columns:
Add that value to both of these squares
Subtract that value from both of these squares
(or vice-versa)
10 5 39 12 15 3 19 29 37 31 13 -15 4 27 -5 40 It works because you are adding and subtracting the same value to two rows and two columns simultaneously, so the sums don't change.
Please note that this tweaking trick will only work with Quadrant-up-to-Perfect Squares if you do the add and subtract trick on all eight squares shown here at once, though you may use +2 and -2 instead of +1 and -1, as long as you use the same values throughout.
+1 -1 -1 +1 +1 -1 -1 +1 You can see why this trick works by observing that the sum of every row, every column, both diagonals, and every quadrant is equal to zero. Even all the minor diagonals add up to zero. (A minor diagonal is a diagonal that wraps around from one side of the square to the other, as if you had the square written on a cardboard tube.)
Your Excel Spreadsheet Program can create Magic Squares: If you use the spreadsheet program below, and only change squares that contain numbers, you should find it very easy to experiment with a variety of magic squares.
Would you like to make another magic square? Just click REFRESH.
Would you like to make a magic square with a specific sum? The easiest way to get a specific sum is to use the form at the top of this page, but if you wish, you may use this URL instead. Just change the number to your desired magic sum:
http://www.mazes.com/magic-squares/random-4-square-method.asp?magicsum=34
(with this URL method, you may request magic squares with magic sums up to 999)
(magicsum=34, simple square)
(magicsum=-34, quadrants)
(magicsum==34, semi-perfect)
(magicsum=*34, perfectly-perfect)
(note that, if you try higher numbers, this program might not
find a perfectly-perfect square, even if it is possible.)
(I'm not 100% certain, but I believe that perfectly-perfect squares are only possible with even magic sums.
(I wrote a program to try many possibilities, and only found even perfect squares.)
If you wish, you may download a copy of this Magic Square spreadsheet that will let you make magic squares with your copy of Excel. I have protected the sheet so that only the number squares can be edited.
If your web browser does not allow you to use our Interactive Magic Square Spreadsheet, put the values and formulas you see below into your spreadsheet program, and you should have a Magic Square Generator of your very own:
| Column A | Column B | Column C | Column D | Column E | Column F | Column G | |||
| Row 1 | 0 | =A8-B2-B3-B4 | =A8-A1-B1-D1 | 3 | =SUM(A1:D1) | =D1+C2+B3+A4 | |||
| Row 2 | =A8-B2-C2-D2 | 5 | 6 | 8 | =SUM(A2:D2) | ||||
| Row 3 | =A8-B3-C3-D3 | =A8-D1-C2-A4 | =A8-A1-B2-D4 | =A8-D1-D2-D4 | =SUM(A3:D3) | ||||
| Row 4 | 12 | 2 | =A8-A4-B4-D4 | =A8-A1-D1-A4 | =SUM(A4:D4) | =A1+B2+C3+D4 | |||
| Row 5 | |||||||||
| Row 6 | =SUM(A1:A4) | =SUM(B1:B4) | =SUM(C1:C4) | =SUM(D1:D4) | |||||
| Row 7 | |||||||||
| Row 8 | 34 | Sum | =IF((A6=A8)*(B6=A8)*(C6=A8)*(D6=A8)*(F1=A8)*(F2=A8)*(F3=A8)*(F4=A8)*(G1=A8)*(G4=A8),"Magic Square","ERROR!!!") | ||||||
David Hrbacek and Arleen Knoderer
P O Box 235
Sulphur Springs, AR 72768-0235
United States