Drexel dragonThe Math ForumDonate to the Math Forum

Ask Dr. Math - Questions and Answers from our Archives
_____________________________________________
Associated Topics || Dr. Math Home || Search Dr. Math
_____________________________________________

How to Create a 4 x 4 Magic Square

Date: 01/28/2004 at 02:22:30
From: Bernard
Subject: Math addition grid -- amazing!

I've been trying to figure out this problem for years now!  Given a 4
X 4 grid (16 squares), I have heard that there is a way to QUICKLY
write a number in each square so that all the rows and columns, both
diagonals, and even the four middle squares and the four corner
squares will each add up to any desired number, such as 58.

I know you can figure it out by trial and error, but is there really a
fast method that always works for any number?  Can you help me?



Date: 01/28/2004 at 03:18:19
From: Doctor Greenie
Subject: Re: Math addition grid -- amazing!

Hello, Bernard --

I searched the Dr. Math archives using the key phrase "magic square" 
and came up with this link which contains a lot of information on 
magic squares:

    http://mathforum.org/alejandre/magic.square.html 

I also found the following page in the archives which gives a simple 
process for building a magic square of any odd dimension (3 x 3, 5 x
5, etc.):

    http://mathforum.org/library/drmath/view/57967.html 

This link also contains a link to another web site containing a very 
comprehensive presentation of all anyone would want to know about 
magic squares.

I was surprised to not find any pages in the Dr. Math archives showing
the easy way to build a 4 x 4 magic square--which is the subject of
your question.

Here is the process:

For the first step, start at the upper left and follow the path you
would if you were reading a book--across the page to the right, then
down to the left end of the next line, across the page on that line,
and so on.  Count the squares you are traversing, and enter the number
of that square only if the square lies on one of the diagonals of the
square.  At the end of this first step, the incomplete magic square
looks like this:

   +-----+-----+-----+-----+
   |     |     |     |     |
   |   1 |     |     |   4 |
   |     |     |     |     |
   +-----+-----+-----+-----+
   |     |     |     |     |
   |     |   6 |   7 |     |
   |     |     |     |     |
   +-----+-----+-----+-----+
   |     |     |     |     |
   |     |  10 |  11 |     |
   |     |     |     |     |
   +-----+-----+-----+-----+
   |     |     |     |     |
   |  13 |     |     |  16 |
   |     |     |     |     |
   +-----+-----+-----+-----+

Next, turn around and reverse direction, so that you are moving 
right to left across the bottom row and, when you reach the left edge, 
moving up to the right end of the next line above and continuing 
like that until you get back to the top left square.  Again count 
the squares you are passing through, and enter the number of that 
square in each square which doesn't already contain a number.  Your 
completed magic square now looks like this:

   +-----+-----+-----+-----+
   |     |     |     |     |
   |   1 |  15 |  14 |   4 |
   |     |     |     |     |
   +-----+-----+-----+-----+
   |     |     |     |     |
   |  12 |   6 |   7 |   9 |
   |     |     |     |     |
   +-----+-----+-----+-----+
   |     |     |     |     |
   |   8 |  10 |  11 |   5 |
   |     |     |     |     |
   +-----+-----+-----+-----+
   |     |     |     |     |
   |  13 |   3 |   2 |  16 |
   |     |     |     |     |
   +-----+-----+-----+-----+

In this magic square, the sum of each row, column, and diagonal is 
34.  If you add the same number to every number in the square, you 
get another magic square with a different sum for each row, column, 
and diagonal.  For example, if you add 6 to every number in this 
basic magic square, you add (4 times 6) to the common sum, so the 
common sum is now 34 + 24 = 58.

So, given the desired sum of 58 (your specific example), and knowing
that the common sum of the "basic" magic square is 34, you subtract 34
from 58 to get 24 and divide that by 4 to get 6.  This "6" tells you
that you need to add 6 to every number in the magic square; you
accomplish this by building your magic square using the numbers 7
through 22 instead of 1 through 16.

Of course, if you want the numbers in your magic square to be
integers, you can't get ANY common sum--you can only get common sums
which differ from 34 by some multiple of 4.  So if you are asked to
build a magic square with a common sum of 100, you see 100 -34 = 66,
which is not a multiple of 4, so you say, "It can't be done."  But if
you are asked to build a magic square with a common sum of 678, you
see 678 - 34 = 644, and 644/4 = 161, so you add 161 to every number in
the basic magic square and so build a magic square using the integers
162 through 177.

I hope all this helps.  Please write back if you have any further
questions about any of this.

- Doctor Greenie, The Math Forum
  http://mathforum.org/dr.math/ 



Date: 01/31/2004 at 03:01:33
From: Bernard
Subject: Thank you (Math addition grid -- amazing!)

Thank you VERY VERY VERY much for answering my question!  Your reply
was very thorough, and I understand the puzzle now!  You really made
my day... no, my week... no, my month!  Thanks a billion!
Associated Topics:
Elementary Puzzles
High School Puzzles
Middle School Puzzles

Search the Dr. Math Library:


Find items containing (put spaces between keywords):
 
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

_____________________________________
Math Forum Home || Math Library || Quick Reference || Math Forum Search
_____________________________________

Ask Dr. MathTM
© 1994-2013 The Math Forum
http://mathforum.org/dr.math/