Complete the magic square!

So, my math teacher gave us a magic math square with

• the 9 in the bottom right corner,
• the 7 in the left column middle row, and
• the 1 in the middle column top row.

She said she would give whoever figured this out a can of soda from the teachers' lounge. I can't figure it out. I've tried nonstop for 2 days$\ldots$ I need help :(

For those of you who don't know, a magic square is a grid with (in this case) 9 boxes and you have to put the numbers 1-9 in each square. Each column, row, and diagonally have to equal the same number. My math teacher said her and the other math teachers have found a way so it is possible but I'm not the best at math so I really need some help.

• Are we allowed to use numbers apart from 1-9? Oct 26 '15 at 6:56
• @ghosts_in_the_code, "you have to put the numbers 1-9 in each square" Oct 31 '15 at 7:00
• Two days non-stop!? Are you sure there isn't an easier way to obtain a can of soda? ;-) Apr 24 '20 at 19:56

Given your description, the filled-in numbers on the magic square look like this:

$$\begin{array}{c|c|c} &1&\\\hline 7&&\\\hline &&9 \end{array}$$

Now, other answerers have pointed out that the middle number is 5, so the 9 should go on the bottom rather than the bottom-right, in which case the completed magic square looks like this:

$$\begin{array}{c|c|c} 6&1&8\\\hline 7&5&3\\\hline 2&9&4 \end{array}$$

But that's only for a magic square with the numbers 1 to 9. If you thought a little outside the box, you might wonder whether you could do it with other numbers.

We can use some algebra to show that this is still impossible. Let's suppose the number 1 isn't filled in, and the middle number is $x$, like so:

$$\begin{array}{c|c|c} &&\\\hline 7&x&\\\hline &&9 \end{array}$$

One of the properties that all 3-by-3 magic squares have is that the rows, columns, and diagonals add up to $3x$ (3 times the middle number). So we can fill in some of the other numbers with respect to $x$, by subtracting $3x$ from them:

$$\begin{array}{c|c|c} 2x-9&&\\\hline 7&x&2x-7\\\hline &&9 \end{array}$$

And then solve for the other two corner squares:

$$\begin{array}{c|c|c} 2x-9&&x-2\\\hline 7&x&2x-7\\\hline x+2&&9 \end{array}$$

And finally solve for the last two edge squares.

$$\begin{array}{c|c|c} 2x-9&11&x-2\\\hline 7&x&2x-7\\\hline x+2&2x-11&9 \end{array}$$

Huh? It turns out that no matter what the middle number $x$ is, if the 7 and 9 are placed where they are, the top square has to be 11. The fact that it was filled out as 1 means that the magic square contradicts itself.

But then again... if you think a little further outside the box, who said that the filled-in squares had to remain unmodified? If you draw another 1 next to the existing 1 in the top square, you get 11 as required.

So... do that. Then, fill in any single number on any square and the rest of the numbers will work themselves out like magic. You can ask your teacher for that can of soda now ;-)

...except not really. Your teacher probably still expects a solution with distinct positive integers (whole numbers that are all different). There exists one, but I'll leave it to you to figure it out on your own since you seem to want to do as much of this as you can by yourself.

It's not possible. I think this website explained very good why: http://www.mathematische-basteleien.de/magsquare.htm

To quote it:

You have 1+2+3+4+5+6+7+8+9=45. In a magic square you have to add 3 numbers again and again. Therefore the average sum of three numbers is 45:3=15. The number 15 is called the magic number of the 3x3 square.  You can also achieve 15, if you add the middle number 5 three times.

You can reduce 15 in a sum of three summands eight times:15=1+5+9   15=1+6+8. 15=2+4+9  15=2+5+8  15=2+6+7   15=3+4+8 15=3+5+7   15=4+5+6 The odd numbers 1,3,7, and 9 occur twice in the reductions, the even numbers 2,4,6,8 three times and the number 5 four times.  Therefore you have to place number 5 in the middle of the magic 3x3 square. The remaining odd numbers have to be in the middles of a side and the even numbers at the corners.  Under these circumstances there are eight possibilities building a square: All the eight squares change into each other, if you reflect them at the axes of symmetry. You count symmetric squares only once. Therefore there is only one magic 3x3 square.

• It's also impossible if you don't limit yourself to the numbers 1-9. Currently writing up an answer about why.
– user88
Oct 23 '15 at 21:34

Lateral thinking solution:

96 91 98

97 95 93

92 99 94

I saw it from another post, so it's not original.

• It's weird - the other post had -1 votes, but now that you've reposted it, it has 1 vote.
– user88
Oct 30 '15 at 14:54
• @JoeZ. Pretty much the same reason every post by Gamow gets 6-7 upvotes atleast on every question. More rep = more votes Oct 30 '15 at 15:09
• What do you mean by a "credible or official" source? (I've already shown using algebra that no magic square with the three given numbers is impossible in my answer.)
– user88
Oct 30 '15 at 15:45

This is quite old, but another reason why the original magic square is unsolvable: think of evens and odds. Then put a 1 for an odd and a 0 for an even. The original square looks like this:

$$\begin{bmatrix} \cdot & 1 & \cdot \\ 1 & \cdot & \cdot \\ \cdot & \cdot & 1 \end{bmatrix}$$

and there are two odds (i.e. two 1s left to be distributed), which must be placed along the bottom-left-to-top-right diagonal. Clearly, wherever we place them, at least one row (or one column) will be left with only one 1, so the square is unsolvable.

• @ManyPinkHats Thanks for the corrections! Dec 25 '18 at 4:28

According to the conditions, the magic square looks like this:

. 1 .
7 . .
. . 9

To prove it is impossible to solve, I would like to simply focus on attempting to solve the top row.

We will use the number 8 (As is is the largest after 9) in either of the positions marked X :

x 1 x
7 . .
. . 9

This would mean the left and right column would be equal to or greater than 15 which is the required sum of the 3 numbers in a particular column/row. I would like to illustrate this in the two cases that follow

Case 1

Here the sum of the first column is already 15 and hence this row is unsolvable as using any number between 1-9 in the position marked Y would mean the columns exceeds the sum of 15

8 1 .
7 . .
Y . 9

Case 2

Here the sum of the third column is 17 and hence it is not possible.

. 1 8
7 . .
. . 9

Now as 7 as already been used, we cannot use it again in the top row. The remaining largest integers are 6&5, Using these integers in the top row, results in the sum to fall short of 15.

6 1 5                 5 1 6
7 . .        OR       7 . .
. . 9                 . . 9

We see, in the top row 5+6+1 = 12 < 15

Hence this magic square is unsolvable.