www.MAZES.com *
Magic Squares Index *
Properties of a Perfect Square *
Almost Perfect Magic Trick *
Perfect Magic Square Trick for Even Sums *
Odd Perfect Squares? *
Usage Agreement & Donations Deeply Appreciated
| 27 | 6 | 8 | 13 |
| -3 | 24 | 16 | 17 |
| 19 | 14 | 0 | 21 |
| 11 | 10 | 30 | 3 |
This perfect magic square was made using
16, 14 and 24 as the first three numbers (inside numbers),
27 as the fourth number (top left number),and
24 as the first temporary sum.
All the rest of the numbers were calculated,
using methods described on this web page.
This web page will teach you how to create a perfect magic square
using any three numbers of your choice as the first three numbers.
You can find full and complete directions further down on this page,
but we will start with the quick and very short directions.
Short Directions
Follow these directions and watch how it changes the square shown above
1. Pick three different numbers of your choice to go inside the square
then click Please use my three numbers.
2. Pick your choice of value for the top left corner, but do not choose
any of these values: 6, 15, 18, 19, 20, 22, 26.
3. All the remaining numbers on the two diagonals will be calculated.
Read the detailed directions further down on this page
to see exactly how to calculate them.
4. Pick a temporary sum, which will be the sum of the top two numbers
in the first and third columns, and the sum of the
bottom two numbers in the other two columns.
But do not choose any of these values:
-73, 3, 6, 14, 16, 17, 19, 22, 23, 25, 27, 28, 29, 30, 32, 34, 35, 38, 40, 41, 43, 51, 54, 130.
Subtract this temporary sum from the Magic Sum to get the other temporary sum
and write them above and below the columns as shown:
| 24 | 30 | 24 | 30 |
| 27 | | | 13 |
| | 24 | 16 | |
| | 14 | 0 | |
| 11 | | | 3 |
| 30 | 24 | 30 | 24 |
5. Finish the square by subtracting existing numbers from temporary sums
to get the remaining numbers.
Here is the final square.
| 27 | 6 | 8 | 13 |
| -3 | 24 | 16 | 17 |
| 19 | 14 | 0 | 21 |
| 11 | 10 | 30 | 3 |
Very Detailed Directions
This page describes a method that you can use as part of a magic trick for creating Perfect Squares. It is a harder method to learn than the
'Almost-Perfect Magic Square Magic Trick' described here. But with a
little bit of practice, you will find that this is a relatively easy trick to use on stage or with small groups, especially if you practice picking
a fourth number that is compatible with the first three numbers.
Basically, this trick allows you to create a perfect magic square that contains any three (different) numbers picked by members of your
audience. You can even let an audience member choose a fourth number, as long as they don't pick one of the numbers you calculate, from the
first three numbers, as being incompatible.
You can see more detail about why this trick works by looking at our
Odd Perfect Magic Square web page, a page that we created
to prove why it is impossible to create a perfect magic square that has an odd magic sum. (Only even magic sums are possible when you
create a perfect magic square containing only whole (integer) numbers.
Summary of one creation strategy
(further down, I will describe a slightly different strategy in much greater step-by-step detail)
- Let audience member(s) pick three different numbers
- Put them, in any order, into squares A, B and C.
- Pick a fourth number that is compatible with the first three numbers
• D not equal to half the sum of any two of the three numbers, such as: (A+B)/2
• D not equal to one-third the sum of all three numbers: (A+B+C)/3
• D not equal to the sum of two of the numbers minus the third, such as: A+C-B
- Calculate the next four numbers based on exact rules:
• Sum of first two rows is equal, calculate top right corner
• Sum of first two columns is equal, calculate bottom left corner
• Calculate the Magic Sum: Add up the diagonal
• The four corners add up to the Magic Sum, calculate the bottom right corner
• The other diagonal also adds up to the Magic Sum, calculate the missing number
- Pick two temporary sums that add up to the Magic Sum (sum1+sum2=MagicSum). (This step can be tricky, because the
wrong temporary sums can lead to duplicate numbers, so study the detailed directions and practice, practice, practice.)
- Temporarily write (or imagine) those temporary sums alternately above the columns (left to right) and continue to write
them alternately under the columns going back (right to left)
- Subtract each existing number in the magic square from the nearest temporary sum to get the number for the blank space
also nearest that temporary sum.
The first eight numbers in our perfect square
and how they relate to each other
Here is a diagram showing the first eight numbers that we will put into our
our perfect magic square (in the order that we will choose or figure them.
Special relationships among the first eight numbers
There is a very special relationship between these numbers in a perfect square:
- d+e=c+a: The sum of the first row must equal the sum of the second row.
- b+h=f+g: The sum of the third row must equal the sum of the fourth row.
- d+f=c+b: The sum of the first column must equal the sum of the second column.
- a+h=e+g: The sum of the third column must equal the sum of the fourth column.
- a+b=d+g and c+h=e+f: The sum of two corners on one diagonal must equal the sum of the two inside
numbers on the other diagonal.
You can see PROOF that these relationships must be true on my Odd Perfect Square page.
Algebraic Perfect Square
Here are the first eight numbers of our perfect magic square using formulas:
| D | | | A+C-D |
| | C | A | |
| | B | A+B+C-2D | |
| B+C-D | | | A+B-D |
And here is the entire perfect magic square using algebraic formulas, assuming that "s1" and "s2" are two numbers
that add up to the magic sum.
| D | s2-C | s1-A | A+C-D |
| s1-D | C | A | s2-A-C+D |
| s2-B-C+D | B | A+B+C-2D | s1-A-B+D |
| B+C-D | s1-B | s2-A-B-C+2D | A+B-D |
Detailed information about picking these two temporary sums in such a way to reduce the chances
of getting duplicate numbers is given further down in the step-by-step directions.
But ... you do NOT need to remember the formulas in either of these algebraic squares. I just present them here so that you can see
how these eight numbers work together and why using two temporary sums works so well in the final steps.
The step-by-step directions that I will demonstrate below are much easier to understand than these formulas, so now that you've seen them,
just forget them, and keep reading.
The first three numbers you put into your perfect magic square can be any three different numbers of your choice. If you would like to tell
me what three numbers to use on this page, please put three numbers of your choice into this box:
Of course, if you are learning this trick to use in front of an audience, you can let one or three of your audience members pick the numbers.
You could even use that beach ball method of picking the three people who will give you their favorite numbers (tossing the ball from person
to person, whoever catches the ball gives you a number). Or, if you wanted to, you could pick one person
in the audience, ask their birthday, and use those three numbers to create it. There are lots of ways to come up with the first three numbers.
(One thing that you'll need to decide is how high to allow these numbers to go. I suggest limiting it to numbers up to 31 or so, because
otherwise, the magic sum might get too high to do arithmetic in your head. If you limit the first three numbers to about 20 or so, you will
find it easier to keep the magic sum under 100. Just remember that the magic sum will be equal to double the sum of the three audience
numbers minus double the number you choose, but you don't want to use this fact to pick a large fourth number to bring down the magic sum
because that might mean having to deal with negative numbers in multiple positions. (I usually try to pick my fourth number such that it is
less than the sum of the two smallest audience numbers.)
Let's demonstrate the process using 16, 14 and 24 as our three numbers, and let's put them into our square in place of
the letters a, b and c.
There are a few restrictions for the fourth number
We can't let an audience member pick our fourth number, unless we first tell them what values we are not allowed to use. In general, I
expect that you'll generally want to pick your own fourth number. Here are the values that we cannot allow our fourth number to be equal to:
- D cannot be equal to half the sum of any two of these three values:
D can NOT be equal to: (16+14)/2 =15, or (16+24)/2 =20, or (14+24)/2 =19
- D cannot be equal to one-third the sum of all three numbers:
D can NOT be equal to: (16+14+24)/3 =18
- D cannot be equal to the sum of any two of these values minus the third:
D can NOT be equal to: 16+14-24 = 6, or 16+24-14 = 26, or 14+24-16 = 22
Pick any value for D that is not equal to any of these restricted values. Here are some of the values that you can choose from for D:
0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 21, 23, 24, 25, 27, ... (there are many more).
If you want to choose a value for this fourth number that will always work, and if you don't mind if some of your calculated numbers are
negative, you could always get away with using D=A+B+C; or use D=A+B-C+1 (where C is the smallest of the first three numbers).
However, when you pick a D value that is reasonably small, which means you have to make sure it's not one of the forbidden values, you may
end up with fewer negative numbers in your final result. As I mentioned above, I usually try to pick D such that it is less than the sum of the
two smallest audience numbers.
Can you choose your own magic sum?
You can either pick from certain values for your fourth number, or you can pick what you want your (even) magic sum to be, then
see if it's going to be possible by checking to see if the value of D that would be required to make that sum is an allowed value.
What is the Magic Sum equal to?
Add the first three numbers that your audience members picked, then subtract the fourth number, then double that result. That total will
represent the magic sum for the square that you are creating. Here is the formula:
If you want to pick a meaningful Magic Sum, add the three audience-selected numbers, double the sum, then look at the allowable values for
the fourth number, subtract double each of those numbers from the doubled sum, then use the value for D that makes the nicest magic sum.
Our Fourth Number
Let's use 27 for our fourth number. If you would like to use a different value for our fourth number, please put that number into this
box, then click the button. (If you enter an invalid number, we will pick a random number for your fourth number.)
Using 27 as our fourth number gives us 54 as our Magic Sum because (16+14+24-27)*2=54.
Special Relationships Revisited
Now, we can take advantage of the special relationships we talked about earlier to help us figure out the next four values for our perfect
square. First, I'll give the equation from our prior discussion, then I'll isolate our new value by subtracting the other number from both
sides of the equation:
The top two rows are equal
D + E = C + A
The sum of the top two corners must be equal to the sum of the two inside numbers in the second row. If you subtract D from both sides of
this equation, you get: E=C+A-D.
Calculate: e = 24+16-27 = 13 and put that value into your square.
The left two columns are equal
D + F = C + B
The sum of the two left corners must be equal to the sum of the two inside numbers in the second column. If you subtract D from both sides
of this equation, you get F=C+B-D.
Calculate: f = 24+14-27 = 11 and put that value into the proper position.
Sum of opposite corners equals Sum of other diagonal's inner numbers
D + G = A + B
(or: the four corners add up to the magic sum)
The sum of two corners on one diagonal must be equal to the sum of the two inner numbers on the other diagonal. Subtract D from both
sides of this equation and you get: G=A+B-D.
Calculate: g = 16+14-27 = 3 and put that value where it belongs.
Alternate Directions: Subtract the other three corners from the magic sum to get the fourth corner: Calculate:
54-27-13-11=3.
The bottom two rows are equal
B + H = F + G
(or: the four inside numbers add up to the magic sum)
The sum of the bottom two corners must be equal to the sum of the two inside numbers in the third row. If you subtract B from both sides
of this equation, you get: H=F+G-B.
Calculate: h = 11+3-14 = 0 and put that result into the square.
Alternate Directions: Subtract the other three inside numbers from the magic sum to get the fourth inside number: Calculate:
54-16-14-24=0.
Other Interesting Properties of Perfect Squares
that will help us find the other eight values
and finish the perfect magic square
Here are a few other interesting properties of perfect magic squares:
- The sum of the top two numbers in the first column ...
... must be equal to the sum of the bottom two numbers in the second column
... must be equal to the sum of the top two numbers in the third column
... must be equal to the sum of the bottom two numbers in the last column.
- The sum of the bottom two numbers in the first column ...
... must be equal to the sum of the top two numbers in the second column
... must be equal to the sum of the bottom two numbers in the third column
... must be equal to the sum of the top two numbers in the last column.
- These two sums must add up to the magic sum, because the sum of the four numbers in one column is the magic sum.
We can take advantage of this fact to make it easier to pick our last 8 numbers
- Pick two temporary sums that add up to the magic sum.
- Pick your first number somewhat at random. Here are some of the values that we can use for our first temporary sum: 18, 20, 21, 24, 26, 31, 33, 36, 37, 39, ... (there are many other numbers that can work here)
- Let's choose 24 for our first temporary sum. Put your first number temporarily above the first and
third columns and below the second and fourth columns of our magic-square-in-process.
- Subtract the first number you pick from the magic sum to get the second number. For example, 54
minus 24 is equal to 30.
- Put your second number temporarily above the second and fourth columns and below the first and third
columns of our square-in-process.
- If your two numbers are both positive, you are more likely to have duplicate numbers in your finished magic square,
so be sure to remember to double-check for duplicates.
- Once you've practiced this magic trick several times, you'll be able to start imagining these temporary sums
above and below the magic-square-in-process instead of writing the numbers down.
- Magician Alert: If one of your temporary sums is negative (or zero) and the other is larger than (or equal to) the
magic sum, you are almost guaranteed not to have duplicate numbers in your finished puzzle, so if you're using this
trick in front of an audience, you might want to experiment to see which values for these temporary sums give you the
best results for avoiding duplicate numbers. I have not given it a lot of study, but I'm guessing if one temporary sum is
at least double the largest number in the square so far, and the other temporary sum is less than half that first temporary
sum, you should probably be able to almost certainly avoid duplicates. Actually, it should be obvious that, as long
as the two temporary sums are farther apart than the distance between the largest and the smallest number in the grid
so far, that you cannot have duplicates, because your eight new numbers would be (sum1-a), (sum1-b), (sum2-c),
(sum1-d), (sum2-e), (sum2-f), (sum1-g) and (sum2-h). I'll leave it as an exercise for the visitor to show why you don't
have to worry about duplicates when your two temporary sums are far enough apart.
- Alternate these two temporary sums above the top of the square-in-process, and alternately moving back below the bottom
of the square. If you do this correctly, the sum of every two neighboring temporary sums will be equal to the magic sum,
and the sum of the temporary sum above and below one column will add up to the magic sum.
Two Temporary Sums are a fantastic shortcut
Let's use 24 as our first temporary sum. If you would like to use a different temporary sum, you may put that value into this box,
then click the button. If you put in a value that would result in an invalid square (because of duplicate numbers), I will change your number to
a random number of my choice.
| 24 | 30 | 24 | 30 |
| 27 | | | 13 |
| | 24 | 16 | |
| | 14 | 0 | |
| 11 | | | 3 |
| 30 | 24 | 30 | 24 |
- Subtract the number that is already in the first (or second) row from the number above the column to get the missing
number for the second (or first) row.
- Subtract the number that is already in the third (or fourth) row from the number below the column to get the missing
number for the fourth (or third) row.
- If you see that you've gotten a number that matches another number already written somewhere else inside the square,
you'll have to try another two temporary sums and do the eight numbers again. (Unfortunately, there does not appear
to be a formula we can use to avoid duplicate numbers, but the 'one negative sum' trick I mention above can make it
much less likely to happen.
| 24 | 30 | 24 | 30 |
| 27 | 30-24 | 24-16 | 13 |
| 24-27 | 24 | 16 | 30-13 |
| 30-11 | 14 | 0 | 24-3 |
| 11 | 24-14 | 30-0 | 3 |
| 30 | 24 | 30 | 24 |
Here is our final Perfect Magic Square
| 27 | 6 | 8 | 13 |
| -3 | 24 | 16 | 17 |
| 19 | 14 | 0 | 21 |
| 11 | 10 | 30 | 3 |
The author puts a great deal of time and effort into creating these web pages. You are welcome to use the information on this page in any
non-profit way that you wish, but if you use our information in any way as part of a profit operation, you are required
to send an appropriate donation as a large token of your appreciation. (Please be as generous as you can.) If you use this method as part
of a regular act, or if you use it on any semi-regular basis, you should make donations on a regular basis.
In any case, if you enjoy what you learn from my web pages, please make a donation. Web pages are our main source of income, and your
donations help keep them free for all to view.

Donations may be mailed to:
Arleen Knoderer, John, and David Hrbacek
P O Box 235
Sulphur Springs, AR 72768-0235 USA
Or you can make donations via PayPal by clicking here
