From: Jeremy Boden
Newsgroups: sci.math
Subject: Re: magic square
Date: Sun, 13 Sep 1998 00:47:13 +0100
In article <6teois$d9n$1@nnrp1.dejanews.com>, leofres@my-dejanews.com
writes
>I've been challenged to find a solution for a matrix problem. I have been
>trying for a week without luck. I need to arrange the numbers from 1 to 64
>(without repeat) in a matrix 8 by 8 in such way that all the rows and columns
>summation equals 260. And not only that, but find the formula for any size
>arrangement.
>
>Any help will be welcome.
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
This is your lucky day! I was clearing out my collection of 'junk' files
from my machine today but retained EXACTLY what you have asked for! I'm
afraid I can't tell you who sent it to me - it was some time ago.
So read on...
________________________________________________________________________
Magic Sauares
Chani Welch
ma163sbj
Presented 5/17/95
Received 24 May 95
DEFINITION/CONSTRUCTION:
A magic square consists of an NxN (N = 3,4,5...) matrix of
numbers.
These numbers are usually consecutive integers (not a requirement).
There are two types of magic squares - odd and even. Both odd and even
magic squares have the following property:
(1) The sum of all rows and all columns should equal the same
amount.
Odd magic squares have these additional properties:
(1) The sum of each main diagonal should equal the same amount as
the sum of each row and column.
(2) The sum of any two numbers geometrically equidistant from the
center should be two times the amount of the center number.
Even magic squares have this additional property:
(1) The sum of any two numbers geometrically equidistant from the
center should equal the sum of the first and last numbers in the
series of numbers you are working with.
Here is an example of an odd and an even magic square:
7x7 (odd): 8x8 (even):
30 39 48 1 10 19 28 1 63 62 4 5 59 58 8
38 47 7 9 18 27 29 56 10 11 53 52 14 15 49
46 6 8 17 26 35 37 48 18 19 45 44 22 23 41
5 14 16 25 34 36 45 25 39 38 28 29 35 34 32
13 15 24 33 42 44 4 33 31 30 36 37 27 26 40
21 23 32 41 43 3 12 24 42 43 21 20 46 47 17
22 31 40 49 2 11 20 16 50 51 13 12 54 55 9
57 7 6 60 61 3 2 64
Odd: The sum of each row, column, Even: The sum of each row and
and diagonal equals 175. The sum column equals 260. The sum of
of any two numbers equidistant any two numbers equidistant
from the center equals 50. from the center equals 65.
Note that in the odd 7x7 magic square, the center number is 1/2 the sum
of the first and last numbers in the consecutive series 1-49. This
holds true for any odd magic square in which the numbers are
consecutive integers.
Formula for finding the total of each column (and row):
1. Set the value of each column to an arbitrary variable: X.
Count the number of columns, and multiply that number times X.
For example, in a 7x7 matrix, the total of each column = X,
so the sum of all the columns equals 7X.
2. Let N equal the number of columns squared, then use this
formula: N(N+1)/2 to find the total sum of the series.
For example, in a 7x7 magic square, 7 squared equals 49,
so the total sum of the series 1-49 equals: 49(49+1)/2 = 1225.
3. Since 7X = the total sum of the series, 1225/7 = 175 = the
sum of each column (and row).
Once you know what the sum of each row and column should be, it
will be easier to check your magic sqaure for correctness.
There are many ways to construct magic squares, once you have
the basic rules down. I have found that the easiest way to
construct odd and even magic squares is to use a more geometric
approach, vs. an arithmetic approach. It is difficult to explain
the geometric approach here, so a detailed description will be
given in class. I would not suggest using an arithmetic approach
on larger magic squares because it is quite time consuming (not to
mention a big fat headache!). If you happen to miss clas the day I
show you my oh-so-wonderful technique for solving these guys, check
out "Magic Squares and Cubes", by W.S. Andrews (In the Science and
Engineering library), or simply come up to me and ask me to show
you!
For reference purposes, however, I will now try to give a
description for the simplest methods of solving magic squares:
My favorite method for solving odd magic squares is
Loubere's method, which he derived from methods used in India.
Odd Squares: Think of the NxN magic square grid as a cylinder (i.e.
fold the ends backward until they meet, forming a cylinder). We'll
use a 7x7 magic square as an example. First, place the number 1
in the center of the top row. Next, put 2 on the bottom row and
the column to the right of the center column. 3 will be placed
1 row up and 1 column over from 2, 4 will be placed 1 row up and 1
column over from 3. 5 will wrap around to the other side of the
cylinder, 6 will be placed 1 row up, 1 col over from 5, 7 will be 1
row up, 1 column over from 6. This should look like a diagonal line
running up the "cylinder": * * * 1 * * *
* * 7 * * * *
* 6 * * * * *
5 * * * * * *
* * * * * * 4
* * * * * 3 *
* * * * 2 * *
Since 7 is now blocked, place 8 one row beneath 7, and repeat the
same process. When you place a number on the top row, place the
next number on the bottom row in an adjacent column to start a new
spiral. If the number is on the right edge, the next number should
"wrap around" to the other side of the cylinder, continuing its
upward spiral (with the exception of the upper right hand corner).
For example:
30 * * 1 10 19 28 Now go back and look at
* * 7 9 18 27 29 the complete 7x7 square
* 6 8 17 26 * * to examine the complete
5 14 16 25 * * * pattern.
13 15 24 * * * 4
21 23 * * * 3 12
22 * * * 2 11 20
Even Squares: Even sqares are a lot more fun to solve, and there
are many ways to solve them. My favorite solution, developed by
Agrippa (1510 A.D.), is as follows:
Consider the normal order you would fill in a series of numbers into
a square grid: 1 2 3 4 5 6 "O" will denote ordinary
7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24
25 26 27 28 29 30
31 32 33 34 35 36
Now consider the reverse of that order:
36 35 34 33 32 31 "ro" will denote reverse
30 29 28 27 26 25 ordinary.
24 23 22 21 20 19
18 17 16 15 14 13
12 11 10 9 8 7
6 5 4 3 2 1
Now, fill in a 8x8 grid using an ordinary order on both main
diagonals and on a diamond pattern around the sqaure, and use
reverse ordinary order on the remaining cells.
For example:
O ro ro O O ro ro O 1 4 5 8
ro O O ro ro O O ro 10 11 14 15
ro O O ro ro O O ro 18 19 22 23
O ro ro O O ro ro O 25 28 29 32
O ro ro O O ro ro O 33 36 37 40
ro O O ro ro O O ro 42 43 46 47
ro O O ro ro O O ro 50 51 54 55
O ro ro O O ro ro O 57 60 61 64
GENERAL HISTORY:
Chinese Method:
The Chinese constructed even squares much the same way as the
method described above, except their "ordinary" order was from top
to bottom, beginning in the upper left hand corner. This was
because of the use of bamboo strips as writing material. The first
Chinese magic square is seen in the scroll of the river Loh - the
Loh-Shu, a scroll believed to have been created by Fuh-Hi, the
mythical founder of Chinese civilization, who lived from 2858 to
2738 B.C.
The scroll is a 3x3 magic square, where odd numbers are expressed as
white dots, or yang symbols, and even numbers are expressed as black
dots, or yin symbols. The odd numbers are supposed to be symbols of
heaven, while even numbers are symbols of the earth. The first
appearance of the Loh-Shu in the form of a magic square was in
writings from the time period between the latter part of the Chou
dynasty (951-1126 A.D.) and the beginning of the Southern Sung
dynasty (1127-1133 A.D.). A later example of what is believed to be
a similar Chinese magic square is the map of Ho. Looking at the
construction of the map of Ho, however, it is not readily apparent
that it is a magic square, since the numbers are from one to ten,
and the construction does not resemble any patterns of magic squares
we've seen so far.
Confucius (551-479 B.C.) wrote appendices to the Yih King, and
this passage, written around 500 B.C., describes his philosophy on
numbers:
"...The numbers belonging to heaven are five, and those
belonging to earth are five. The numbers of these two
series correspond to each other, and each one has another
that may be considered its mate. The heavenly numbers
amount to 25, and the earthly to 30. The numbers of heaven
and earth together amount to 55. It is by these that the
changes and transformations are effected and the spiritlike
agencies kept in movement."
Looking at the Chinese philosophy on numbers and the differences
in their "magic squares", it is evident that the arrangement of odd
and even numbers was important, but not necessarily the property
that these numbers had to be arranged in a perfect square.
Egypt:
In Egypt, magic squares were used to represent the difference
between order and chaos. Squares made up of two or four cells were
said to represent chaos because they were incapable of forming magic
squares. Magic squares 3x3 or larger were dedicated to the sun,
moon, and planets in the form of talismans. The talismans were
made by taking a magic square and placing it in a polygon with the
number of sides of the polygon equal to the root of the square (i.e.
a 3x3 magic square was placed in a triangle, a 5x5 was placed in a
pentagon, etc..) These polygons were then placed in a circle, and
in between the sides of the polygon and the circle were inscribed
signs of the zodiac. Then, the "good" or "evil" name of the
corresponding planet was written on the talisman. It is rumored
that Pythagoreas, who traveled through Egypt at that time (500
B.C.), was greatly influenced by the Egyptian philosophy on magic
squares and numbers.
India:
Not much can be said for certain of magic squares in India,
since many of the people who have developed upon Indian methods are
from the 17th to 19th century. Many sources I have looked at,
however, have suggested that magic sqares have Indian roots, since
the natives wear them as talismans, and certain architectural works
contain them.
Benjamin Franklin:
Franklin is worth mentioning here for the unusual "properties"
of his 8x8 and 16x16 magic squares. Not only did all the columns
and rows of his magic squares equal the same amount, but other
patterns existed, such as his "bent" diagonals and squares within
the square, that totaled up to the same amount as the rows and
columns. I have provided diagrams of these patterns in the handout
I gave out in class.
Magic Squares in Europe:
Magic squares were introduced into Europe in the 15th century.
The most notable names in devloping methods for solving magic
squares are Agrippa (De Occulta Philosophia (II, 42) - 1510), Bachet
(Problems plaisans et delectables - 1624), De La Loubere (Relation
du Royaume de Siam - 1693), Ozonam (Recreations Mathematiques -
1697), Poignard, and De La Hire.
The methods used by Agrippa and Bachet for solving both odd
and even magic squares are given in the handout. Loubere's method
(the "cylinder" method) is given in the handout as well.
Ozonam uses ideas similar to Agrippa and Bachet, but his
method is a bit more complicated, so I will not go through the
trouble of describing his earlier magic squares. In Ozonam's later
work, Recreations Mathematiques et Physiques (1750), he uses the
concept of the "knight's move" to construct magic squares. Anyone
who has ever played chess will be familiar with the movement of a
knight on a chessboard. For those of you who don't play chess,
however, a knight moves in a "L" shaped pattern - two squares up
and one square over, or one square up and two squares over, are both
acceptable movements for a knight. Using this concept, Ozonam was
able to construct a magic square by taking a grid and moving in "L"
shaped patterns around the grid, landing on each cell in the grid
exactly once. Anytime the knight was at an edge of the grid, it
would simply wrap around to the other side of the grid to complete
its movement. Unfortunately, I believe this example only works for
an 8x8 grid, which is the standard size of a chessboard, although it
may work for various other even grids larger than 8x8.
Finally, we come to an example of an arithmetic method. This
particular method, first developed by Poignard and later improved
upon by De La Hire, is one of the simplest arithmetic methods I've
seen so far. For this example I will use a 5x5 magic square,
although this method works for even squares as well:
First, construct an NxN matrix, using numbers from 1 to N in
the following pattern:
(5x5) -----> 1 2 3 4 5 Now constuct a 20 15 10 5 0
N = 5 2 3 4 5 1 matrix using 0 20 15 10 5
3 4 5 1 2 multiples of N 5 0 20 15 10
4 5 1 2 3 (5x5) ----> 10 5 0 20 15
5 1 2 3 4 15 10 5 0 20
Now, add these two matrices 21 17 13 9 5
together, and you get an NxN ------> 2 23 19 15 6
(in this case, 5x5) magic 8 4 25 16 12
square. 14 10 1 22 18
20 11 7 3 24
There are many other ways of constructing magic squares, and
many new geometric developments involving magic squares like magic
cubes, magic pentagons, magic squares in circles, magic squares in
borders, etc. Since I do not have the time to go into any of these
new methods in depth, however, I will conclude with the following
exercise:
Construct an odd magic square of 9x9 or larger OR
construct an even magic square of 8x8 or larger using a pattern
different from those given in the handout.
Bibliography:
Andrews, W.S. "Magic Squares and Cubes", The Open Court
Publishing Company, Chicago 1908.
Falkner, Edward. "Games Ancient and Oriental and How To Play
Them", Dover Publications, Inc., New York 1961.
Kraitchik, Maurice. "Mathematical Recreations", Dover
Publications, Inc., New York 1953.
Stern, David. "Math Squared", Teachers College Press, New
York 1980.
--
Jeremy Boden