• Quick note - the problem with Youtube videos not embedding on the forum appears to have been fixed, thanks to ZiprHead. If you do still see problems let me know.

Fun With Magic Squares

Dr Adequate

Banned
Joined
Aug 31, 2004
Messages
17,766
This kept me amused for a while.

For the purposes of this post, a magic square is an arrangement of the numbers 1, 2, 3, 4, 5, 6, 7, 8, 9 each in a different cell of a 3 x 3 grid such that the numbers in every row, column, and diagonal of the grid add up to the same sum.

Here's an example --- or you may prefer to find one yourself, hence the spoiler.

8 3 4
1 5 9
6 7 2

Question (difficult version) : find how many magic squares there are and prove it.

Question (moderate version) : prove that there are exactly

eight

magic squares.

Question (easy version) : prove the following things in the following order:

Every row, column, and diagonal adds up to 15.
The number in the centre square must be 5.
The number 1 can't go in a corner square.
The 8 and the 6 must go either side of the 1.
There are exactly eight magic squares.

Enjoy... I'd put this in puzzles, except that's mostly for wordgamers.
 
Dr Adequate said:
This kept me amused for a while.



Question (moderate version) : prove that there are exactly

eight

magic squares.


This is not quite right.
Rotations and reflectiions are not considered separate answers. In this case, for example, in all of your eight "different" answers, 2 is in a corner, 8 is in the opposite corner, 1 is next to the eight, nine is opposit the one, and next to the two, and so on. Once you place the 2 in a corner, the 8 is forced. Then, once you place any of the others, which are forced into one of two positions, all of the others are forced.

So there is only one unique 3x3 magic square.
 
I should point out, pace my esteemed colleague Gwyn ap Nudd, that in the hints I am counting magic squares related by rotation and reflection as different magic squares.
 
Dr Adequate said:

For the purposes of this post, a magic square is an arrangement of the numbers 1, 2, 3, 4, 5, 6, 7, 8, 9 each in a different cell of a 3 x 3 grid such that the numbers in every row, column, and diagonal of the grid add up to the same sum.

What about doing a slightly more complicated counting and remove the requirement that the diagonals add up to the same sum as rows and columns.

How many such squares there are? And how many possible different sums there are?
 
LW said:
What about doing a slightly more complicated counting and remove the requirement that the diagonals add up to the same sum as rows and columns.

How many such squares there are? And how many possible different sums there are?
This is actually an easier question.

First of all, there are at least 56 of them. For take the square

4 8 3
9 1 5
2 6 7

which fits the criteria. This has eight different versions by rotation and reflection around the number 1, and we then have nine variations on each (imagine shifting the number 1 to any position on the grid, and shifting the rest of the numbers with it, with wraparound, e.g:

7 2 6
3 4 8
5 9 1

I shall show that there are at most 56 such squares.

Note that as 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 = 45, each column, and each row, still has to add up to fifteen.

Now, the number 1 has to go somewhere. There are 9 alternatives.

The only pairs of numbers available adding up to 14 are 9 + 5 and 8 + 6, so one of these pairs must go in the same row as the 1, and one must go in the same column. That's another two alternatives.

Then you have two choices of which way round the 8 and the 6 go, and a further two choices as to which way round the 9 and the 5 go.

That makes 56 alternatives so far.

There are then no more choices to make. For the number 7 can't go in the same line as either the 8 or the 9. It then follows that it must share a line with the 5 and with the 6. This allows these two lines to be filled in --- the third number is forced to be 3 and 2 respectively. This leaves one space to put the 4 into --- it must share a line with the 8 and the 9.

We know of course that there is such a square (see top of proof).

So there are exactly 56 alternatives.
 
Dr Adequate said:
This is actually an easier question.

Your analysis is otherwise spot on, but you might want to reconsider how you put the figures together.
9*2*2*2 = 72


My reference to the other possible sums came from a typo that added '0' to the set of numbers. When you can choose 9 numbers out of 10, you obviously get more possible combinations.
 

Back
Top Bottom