# Magic square with the position of 8 fixed

A magic square (of order 3) is a 3x3 matrix consisting of distinct numbers from 1 to 9, where the numbers in each row, column and diagonal add up to 15.

For example, the following would be a magic square:

The problem is to construct a magic square that has the position of the number 8 fixed.

## 4 Answers

As Kendall mentions, it is impossible to move pieces out of a 3x3 grid in this manner. This is called the Lo Shu square, and is the only unique solution to the 3x3 magic grid puzzle.

The reason for this is actually rather simple. If you look at the Lo Shu square, you'll notice that the even numbers always appear in corners. To demonstrate why this would be, note that each row and column must sum to an odd number.

If a row contains an even number of odd numbers, then its solution is either $2(2N+1)+2N=6N+2$ or $3(2N)=6N$, both of which are divisible by two, and therefore cannot add to 15. If a row contains an odd number of odd numbers, then its solution is either $1(2N+1)+2(2N)=6N+1$ or $3(2N+1)=6N+3$, both of which are odd and therefore can equal 15.

This means that each row must contain and odd number of odd numbers. In a 3x3 grid, a row must contain either 1 or 3 odd numbers.

If the center contains an odd number, then two adjacent edges must contain an odd number. However, if two edges contain even numbers, then the corner between them must contain an even. However, if this is the case, the opposing diagonal must also contain two even numbers - but at this point, if it does, then a row contains three even numbers.

In the following grid, it is clear that the question marks indicate positions that must be, but can't be, even.

----------    ----------    ----------
|  |  |  |    |  |EE|  |    |EE|EE|??|
----------    ----------    ----------
|  |EE|  | -> |EE|EE|  | -> |EE|EE|  |
----------    ----------    ----------
|  |  |  |    |  |  |  |    |??|  |  |
----------    ----------    ----------


It is trivial from this point to demonstrate that if there is an even number on an edge, then the grid is unsolvable. It is also trivial to demonstrate that if one even number is in a corner, the rest must be.

Therefore, every solution is the permutation of one solution: where the even numbers are in the corners; and if the even numbers are in the corners, then their positions are irrelevant, because a solution will always be a reflection of that position.

Every normal magic square of order three is obtained from the Lo Shu by rotation or reflection.

From Wikipedia: Lo Shu Square

Since rotation and reflection cannot move the 8 out of a corner, such a square is impossible.

According to Kendall and others, the puzzle isn't solvable for integers. This can be proved using the Lo Shu Square.

But the problem statement says "A magic square (of order 3) is a 3x3 matrix consisting of distinct numbers from 1 to 9", and doesn't explicitly specify integers, a solution with real numbers could be obtained.

Here's one:

+---+---+---+
|4.5| 8 |2.5|
+---+---+---+
| 3 | 7 | 5 |
+---+---+---+
|7.5| 2 |5.5|
+---+---+---+


I'd have used complex numbers, but the condition "numbers must be from 1 to 9" restricts it to real numbers.

• But it doesn't restrict the complex axis! – user20 May 15 '14 at 19:21
• How would you decide if a complex number is between 1 and 9? One can't compare complex numbers. – John Bupit May 15 '14 at 19:29
• I know, I was just poking fun at you for working around the problem :P The complex numbers would need to add to zero, anyway. – user20 May 15 '14 at 19:33
• Yeah, just like the fractions need to add upto an integer. I would have tried something like 5+i 8 2-i for the first row... and so on. Also, @downvoter could I get a reason for the downvote. – John Bupit May 15 '14 at 19:38
• Yeah, pretty much. And, my guess is that the downvoter feels this doesn't honor the spirit of the question. – user20 May 15 '14 at 19:40

Here's an intuitive explanation: let's set the squares to the things we know:

? 8 ?
? 5 ?
? ? ?


We can figure out the bottom one now, since 15-8-5=2:

? 8 ?
? 5 ?
? 2 ?


The other two numbers on the bottom row now must add up to 13, which can only be 9/4 or 7/6. Now let's split this up into those two cases.

## Case 1 (9/4)

? 8 ?
? 5 ?
9 2 4


Note that the top right square has to be 1, and the top left 6 (using the diagonals).

6 8 1
? 5 ?
9 2 4


Now let's use the columns to fill in the rest:

6 8 1
1 5 10
9 2 4


... notice a problem?

## Case 2 (7/6)

? 8 ?
? 5 ?
7 2 6


Fill in the corners as before:

4 8 3
? 5 ?
7 2 6


And the edges:

4 8 3
4 5 6
7 2 6


This one doesn't work either. So, we've proved that this is impossible!

• I typed this all on a mobile device. Please help my fingers :-( – Doorknob May 15 '14 at 17:09
• Ow. Ow. Pain. Firey, burning pain. Wouldst thou like ice? – user20 May 15 '14 at 17:21
• I don't know how you concluded that the center square must be 5. (It is, obviously, but that step is missing from this answer) – trentcl Aug 22 '16 at 15:42