Friday, February 10, 2012

Magic Squares: The Math that Drives Them


                   What is the Math behind Magic Squares?   

    A magic square is basically just an arithmetic sequence arranged in a special way.  What do we know about an arithmetic sequence?  An arithmetic sequence is a sequence of numbers each with a common difference. Looking at it a different way, it is a sequence of number by which each number in the sequence is found by adding a specific number to the first number in the sequence. For Example:  The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11....
 is a  sequence  that starts with 1 and each successive number in the  sequence  is found by adding 1 to the previous number in the  sequence .   Now let’s say we want to know the sum of the first 9 digits in this sequence. We could just add them all up one at a time, but that generally takes more time. And with larger sequences it would take a really long time. So we will set up a formula.

Looking at a arithmetic sequence algebraically we need to set up some variables. We will denote the starting value with, a, and the common difference with x and each term is n so algebraically an arithmetic sequence looks like this A, (A + X),( A + 2X), (A +3X), (A +4X),  ….. (A + Nx),
Where (A + nX) is the nth   term in the sequence.  sis the sum of the ne terms
When we wish to know the sum of n terms of the sequence what we are saying algebraically is
sn =           a         +   (a + x)          +...+ (a + 2x) + …+ (a + (n-2) x) + (a + (n-1) x)

And in order to reduce this to a simple formula we can work with we will take the above sequence and reverse it and add it to itself.

     Sn =           a         +   (a + x)          +...+ (a + 2x) + …+ (a + (n-2) x) + (a + (n-1) x)
+   Sn = (a + (n-1) x) + (a + (n-2) x)  +…+ (a + 2x) +… +    (a + x)      +              a

2 Sn =   (2a + (n-1) x) + (2a + (n-1) x) + …+(2a + (n-1) x) +…+(2a + (n-1) x) 

Since we are working with sequences of n terms grouping the last part is as simple as taking
(2a + (n-1) x), and multiplying it by n

2 Sn = n (2a + (n-1) x)

Then when we divide by 2 we have Sn = n (2a + (n-1) x)
The resulting equation is close to what we will be using for magic squares.
The only difference is that with
Sn = n (2a + (n-1) x) is used with linear sequences that can be graphed out on a
number line.   In order to modify this for working with magic squares we simply square the n Inside the parenthesis ()
  which changes our equation to Sn = n (2a + (n2-1) x)   We do this
 because (n-1) is used to represent last term and in magic squares the number of terms is the dimension squared so the last term would be (n2-1).

No comments:

Post a Comment