# Magic Squares: A Detailed Strategy Guide​

##### by Sylvie Wilson

Magic Squares are simple to explain, yet they can easily lead to hours of fun mathematical explorations. For those of you who are new to the Magic Squares problem, the idea is this: Given n greater than or equal to 3, can you find an n-by-n grid of n^2 consecutive numbers where all the columns, rows, and diagonals add up to the same “magic” number? You can watch the video below for a more in-depth explanation.

## Solving a 3-by-3 Square

The 3-by-3 grid didn’t give me much trouble, and here’s why.

1. Given a little thought, I found that there is a simple calculation to find the “magic number” of any sized grid: Take the sum of every number on the board and divide it by the number of rows. In this case, the magic number is 1+2+…+9 = 45 / 3 = 15.
2. It becomes apparent that the “middle,” most neutral number, 5, works best in the middle of the grid, for balance reasons; lower and higher numbers work well on opposite sides or corners, but it would be near impossible to balance a grid with, say, a 1 in the middle.
3. From there, I just played with the numbers a bit (using Google Sheets to avoid tedious manual calculations) and pretty quickly found a solution.

## Solving a 4-by-4 Square (A Long Way to a Short Answer)

As I examined the 3-by-3 solution, I started noticing patterns. For one, I could see that if I split the numbers into groups (1-3, 4-6, 7-9), I had balanced the grid by ensuring that no number of the same group shared a row or column. It also seemed most advantageous to have the middle number in the middle, because I had yet to find a solution that didn’t put 5 in the middle square. But with a 4-by-4 grid, there is no middle… so how would that work?

Ignoring that temporarily, my initial idea was to look at each number group as a different color, and set up the 4-by-4 grid so that no two boxes of the same color shared a row or column, just to simplify the process I used for the 3-by-3. I figured that after finding that grid, I could swap the numbers in each group among the boxes with their assigned color, and things would just fall into place.

Wrong, again. I tried almost everything I could think of, but even after finding rows and columns that added up to the magic number, I just couldn’t seem to get those pesky diagonals.

Two hours into tinkering around with the numbers, my frustration got the best of me. Forget it, I thought, I’m scrapping all of this. I set up the 4-by-4 grid again, ignoring every rule I had set for myself before. 1… 2… 3… 4… I added to the first row, completing the whole table in sequential order, seeing if I might find some hidden clue in a more ordered grid. To my surprise, the diagonals added up perfectly. Okay, so let’s keep the diagonals

It took about 20 seconds for me to finish the puzzle from there. All I had to do was move the bigger numbers to the bottom to balance out the smaller ones, and shuffle a few of the side numbers around, and… voilà! Just like that, I’d solved it.

You’ll notice a few curious things about this set-up. First, I swapped the lowest and highest numbers (at the top and bottom middle two squares, not in the diagonals) and flipped their order. Then I did the same for the left and right. Could solving a magic square really be that simple?

## Solving a Doubly-Even Square

It turns out, no. But this little clue helped me discover the technique for any n-by-n grid where n is divisible by 4 – or any “doubly even” value of n. Essentially, if you follow the same pattern for an 8-by-8 grid, you keep the 4-by-4 box in the middle and the 2-by-2 boxes in each of the corners the same, and swap the other numbers accordingly.

If you examine this grid, you can see that the swapping of numbers becomes more involved as the square gets bigger, but can still be solved in an ordered fashion.

## Solving an Odd-Numbered Square

When it came to odd-numbered grids, after a while of trying to find a pattern, I gave in and did a quick Google search. Turns out, there is a pretty specific (and simple) pattern for finding an odd-numbered magic square. Start with 1 in the top middle box, then place the next number up one box and to the right one box. But you go off the grid, you’re thinking, how does that work? It works if you follow these three simple rules:

1. If the number’s place is off the top of the grid, instead move the number to the bottom box of the column it’s in (i.e. one column to the right of the previous number).
2. If its place goes off the right edge of the grid, keep the number in the same row, but move it to the leftmost column of the grid.
3. If its place is already taken by an existing number (or it goes off the right top corner), place the new number directly below the last number you placed.
The process looks a little something like this:

## Solving a Singly-Even Square

For a 6-by-6, or any n-by-n grid where n is “singly even” (divisible by two, but not 4), I did some toying around and found this: If you simply solve the four odd-numbered squares in each of the corners as described above (for a 6-by-6, solve the four 3-by-3 squares), balancing out the number groups as shown below, you’re more than halfway there.

You’ll notice that the only parts that don’t add up are the bottom and top three rows as well as the diagonals. After careful examination, it became apparent that you could simply swap a few of the numbers to achieve the perfect balance.

A more clear pattern emerges once you start getting into the bigger squares, but the same basic switch between upper and lower quadrants still occurs.

One thing that bothers me is that, although I’ve discovered patterns and strategies for solving the squares, I don’t completely know WHY those strategies work. There’s still a lot to explore, so I hope you enjoy unveiling some more of the magic yourselves or with your students!