math is an attitude
 
Feb 09, 2010 - 12:08 AM
 
Who's Online
There are 242 unlogged users and 0 registered users online.

You can log-in or register for a user account here.
Sponsored Links
Saturday, March 11, 2006 - 05:59 PM

Printer-friendly page
Magic SquaresTwo days before my major exam, my friend and I sat down to play with magic squares. Obviously a big mistake, but I actually did the best of all in that particular exam. I think it came from cracking the code for any odd magic square.
For those not aquainted with magic squares, there are n X n squares, with numbers from 1 to n2 arranged such that the sum of all the cells in a row and column are the same. For odd squares the sum of the diagonals are also the same and equal to the aforementioned sum.

At first we came across some very interesting facts concerning the square. Based on these we tried to solve the next magic square, and came across some other interesting properties. After some hasty conclusions that each new magic square would add its own set of properties, which, together with previous conclusions, would solve about 90% of the next square, we stumbled across a simple process that could solve any odd magic square. Sadly this method was so much of an anti-climax, after the properties, that we rather we had not found it.

So I'll start in order with the "discoveries" we tried to make. First, try the 3 X 3 magic square. It is fairly simple to guess on your own. I hate to post the spoiler here, but it comes to be,

| 4 | 9 | 2 |
| 3 | 5 | 7 |
| 8 | 1 | 6 |

The sum is 15. Let's observe the following things, which occur in every magic square hence. The centre block has the value (n2 + 1)/2. Here, (9 + 1)/2 = 10/2 = 5. The sum is n*(n2 + 1)/2. 3*5 = 15. We will of course have to cross check with the next block. But first we notice something rather interesting. the UL-DR (Upper Left - Down Right) diagonal is in A.P. (Arithmetic Progression) with d = 1, so 4,5,6. This suggests something similar for the UR-RL diagonal.. It is also in A.P. of d = 3. But 3 is n. We will as I've said have to check with the next one. Here it is. Once again, spoiler warning,

| 11 | 24 | 07 | 20 | 03 |
| 04 | 12 | 25 | 08 | 16 |
| 17 | 05 | 13 | 21 | 09 |
| 10 | 18 | 01 | 14 | 22 |
| 23 | 06 | 19 | 02 | 15 |

The sum is 65. This gives hope to our assumption that sum = n*(n2+1)/2. The centre formula also seems right. We also note that the diagonals in A.P. is also absolutely right. At this juncture I'd like to make a point I should have made before. If you've found a different square, note that the magic squares are symmetric about the middle vertical line, or horizontal line. Just to show you,

| 03 | 20 | 07 | 24 | 11 |
| 16 | 08 | 25 | 12 | 04 |
| 09 | 21 | 13 | 05 | 17 |
| 22 | 14 | 01 | 18 | 10 |
| 15 | 02 | 19 | 06 | 23 |

or

| 23 | 06 | 19 | 02 | 15 |
| 10 | 18 | 01 | 14 | 22 |
| 17 | 05 | 13 | 21 | 09 |
| 04 | 12 | 25 | 08 | 16 |
| 11 | 24 | 07 | 20 | 03 |

are the same magic squares.

Going back to the first square, we could notice some more things. 1 is directly below 13, the centre, and 25 right above it. So we can assume that n2 is directly above it. (this is subject to orientation, and I'm making all my statements with the squares that I've shown first. If you consider another orientation, just flip the stuff about.) Ok another more subtle observation is that if you look at the middle vertical row, and form an A.P. of d=6 with ALTERNATE blocks, you will see that 1, 7, 13, 19, 25 satisfy. We can generalise to n+1. Horizontally, you will see 05 then two blocks to the left, 09, then 13, 17, and finally 21. Yup another A.P. of n-1 = 4 common difference.

Let's go on to 7 X 7. You can actually fill about half of this with what we've covered.

| 22 | 47 | 16 | 41 | 10 | 35 | 04 |
| 05 | 23 | 48 | 17 | 42 | 11 | 29 |
| 30 | 06 | 24 | 49 | 18 | 36 | 12 |
| 13 | 31 | 07 | 25 | 43 | 19 | 37 |
| 38 | 14 | 32 | 01 | 26 | 44 | 20 |
| 21 | 39 | 08 | 33 | 02 | 27 | 45 |
| 46 | 15 | 40 | 09 | 34 | 03 | 28 |

We note the same properties as we saw in the above squares. The only additional point of interest is a very obscure and frankly over done one, which I broke my head to get. Mentally create concentric circles. If you take the following cross,

| \\ | 00 | 00 | || | 00 | 00 | // |
| 00 | \\ | 00 | || | 00 | // | 00 |
| 00 | 00 | \\ | || | // | 00 | 00 |
| == | == | == | -- | == | == | == |
| 00 | 00 | // | || | \\ | 00 | 00 |
| 00 | // | 00 | || | 00 | \\ | 00 |
| // | 00 | 00 | || | 00 | 00 | \\ |

Take a number on the cross. If the number is greater than the central number, 25, you subtract. This is the number in the clockwise direction of your imaginary circle. I know this is a complicated procedure to get across through words only. For example take 31 on the left side. The next circluar number is 06, which is 31-25. However if the number is less than n, 25, add them. This again forms the next number in the clockwise direction. Take 19. The next number is 44, 25 + 19. This gets you the solution the the 5 X 5, where it can be observed also. You'll find a similar pattern in the 9 X 9, but it'd be a bit too complicated for me to explain.

You'll probably notice by now the number of 1 difference AP's scattered around the place. It's not coincidental.

Now is the magic formula that I find great distaste in (about time you'll be saying). Here is the basic algorithm:

  1. Start process from the square below the central block. This block is 1.
  2. If a square is 'r', then the DIAGONALLY DOWN block (not on one of the diagonals neccessarily), and mark it as 'r+1'
  3. If this square is at the edge, treat the square as a closed loop. So you pop out of the top in the place where you would if that row were at the bottom.
  4. If there is a number already in the diagonal block, then drop down two positions from the 'r'. If you are at the edge, just come in from the top, maintaining the same count.
That's it, I'll show in two stages the formula for 9 X 9.

.................VV.......................V..
| 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 05 |
| 06 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 |
| 00 | 07 | 00 | 00 | 00 | 00 | 00 | 00 | 00 |
| 00 | 00 | 08 | 00 | 00 | 00 | 00 | 00 | 00 |
| 00 | 00 | 00 | 09 | 00 | 00 | 00 | 00 | 00 |
| 00 | 00 | 00 | 00 | 01 | 00 | 00 | 00 | 00 |
| 00 | 00 | 00 | 00 | 00 | 02 | 00 | 00 | 00 |
| 00 | 00 | 00 | 00 | 00 | 00 | 03 | 00 | 00 |
| 00 | 00 | 00 | 00 | 00 | 00 | 00 | 04 | 00 |

The single V shows an example of the 'wrap', and the VV show one where the diagonal is occupied.

---------------VV--------------------------
| 37 | 78 | 29 | 70 | 21 | 62 | 13 | 54 | 05 |
| 06 | 38 | 79 | 30 | 71 | 22 | 63 | 14 | 46 |
| 47 | 07 | 39 | 80 | 31 | 72 | 23 | 55 | 15 |
| 16 | 48 | 08 | 40 | 81 | 32 | 64 | 24 | 56 |
| 57 | 17 | 49 | 09 | 41 | 73 | 33 | 65 | 25 |
| 26 | 58 | 18 | 50 | 01 | 42 | 74 | 34 | 66 |
| 67 | 27 | 59 | 10 | 51 | 02 | 43 | 75 | 35 |
| 36 | 68 | 19 | 60 | 11 | 52 | 03 | 44 | 76 |
| 77 | 28 | 69 | 20 | 61 | 12 | 53 | 04 | 45 |

That's it. This formula will work for every odd magic square, but I can't prove it. Can anyone give an explaination for the formula? How does it work? One last trick that the magic square pulled off. I have an exam two days from now. Ironic isn't it?




Comments

SQL Error
Display Order
Re: How to Find any Magic Square
by mathmate
on Mar 13, 2006
Great work Arun. Hope you did well in your exam today.
Now that your exam is over, you'll have time to explore even more on magic squares.

Re: How to Find any Magic Square
by ArunChaganty
on Mar 13, 2006

Umm actually, I have a series of exams, and one day after tommorow(again). Besides, ever since I've found the formula, I've been a bit let down about magic squares. It kinda kills the magic. You all should read the other article about how to logically get the 3X3 square.


Only logged in users are allowed to comment. register/log in
Rating
User's Login




 


 Log in Problems?
 New User? Sign Up!
Sponsored Links