The problem is as follows:

Fill out the empty boxes of the figure from below by writing an integer number on each of them such in a way that by summing three numbers which are in the same row, column or diagonal we can obtain always the same sum. From this which is the number which will occupy the square with orange shade?

The figure is shown below:

Sketch of the problem

  • 17

  • 11

  • 18

  • 10

  • 19

I tried different methods by plugin numbers randomly but at no avail. I also read the article at Wikipedia about magic square and calculating the magic constant but this has not helped me at all.

Therefore I couldn't get to an answer to this, so I was hoping somebody could tell me if there is an algorithm or method that is proven to work to solve these problem without just "guessing".

Please, try to use the most details as possible as I'm not good at using imagination. Do not just fill out the drawing and say that's it. This is not what I'm looking for.

So can somebody help me to get an answer to this problem the most detailed way possible?

  • $\begingroup$ The Wikipedia article assumes that the numbers in a square of side $n$ are from $1$ to $n^2$. You can calculate the magic constant from that, but it doesn't help here because your numbers are not contiguous. $\endgroup$ – Ross Millikan Apr 7 '18 at 14:53
  • $\begingroup$ @RossMillikan Interesting I wasn't even aware of that. So I end up at the starting point. It looks that the magic constant doesn't offer much help for solving these problems. $\endgroup$ – Chris Steinbeck Bell Apr 7 '18 at 15:08
  • $\begingroup$ If you knew the constant for your square the problem would be trivial. The challenge is to derive it. saulspatz has given a good strategy which will work any time you start with three known cells in a $3 \times 3$ grid, two of which are in a row. $\endgroup$ – Ross Millikan Apr 7 '18 at 15:12
  • $\begingroup$ @RossMillikan Sorry if I say this but I'm slow at making pictures in my brain from ideas of others. Why it would be trivial?. Does it mean that knowing less numbers would had rendered the problem not being solved by that strategy?. Out of curiosity. Does a magic square can offer many solutions or none at all a-la solving a system of equations?. $\endgroup$ – Chris Steinbeck Bell Apr 7 '18 at 15:43

I'm adding this answer borrowing @saulspatz suggestions If somebody like me is also struggling with these kinds of questions.

So I'll try to do step-by-step solution:

Initially we have this diagram and it can be seen that there is a constant to be added to a number $x$, thus we label to the orange shade square that variable.

From the first column it is known that the resulting sum is $x+15$

See figure from below:

$\hspace{4cm}$Sketch of the solution

Therefore in the first row we have to fill out the blank space with something so that by summed with $x$ we also get that previous $x+15$.

Since I cannot do it mentally I'll add an additional variable named $a$ as an aid for doing this momentary computation. But it can be omitted if desired.


$$x+3+a=x+15$$ $$a=15-3$$ $$a=12$$

$\hspace{3cm}$Sketch of the solution

See figures 1 and figure 2.

To get the diagonal we know already that we have:


To get $x+15$ I'll use again that auxiliary variable to fill out the blank space in terms of $\textrm{x+something}$

$$a+22=x+15$$ $$a=x-7$$

$\hspace{2cm}$Sketch of the solution

This is indicated in figure 3 and figure 4.

We continue the process by filling up the remaining spaces:

For the second row, third column blank space I used again that auxiliary variable.



$\hspace{2cm}$Sketch of the solution

For this you can see it how it was filled in figure 5 and figure 6.

For the third row, second column the blank space is filled as follows:



$\hspace{2cm}$Sketch of the solution

This is seen in figure 7 and figure 8

Finally all that is left to do is fill out the last blank space, third row, third column:




$\hspace{2cm}$Sketch of the solution

And this is seen in figure 9 and figure 10.

At this point we can calculate the sum by equating the diagonals from both directions, from northwest to southeast with the diagonal from northeast to southwest.

See figure 11

$\hspace{5cm}$Sketch of the solution





Therefore by replacing in the figure we get to:

Since all the sums check:







Then both diagonals



So the number must be $18$

$\hspace{4cm}$Sketch of the solution

See figure 12 for details.

So that's it. This process as mentioned in the comments seems a good strategy when the problem is stated this way, hope it can help others as well.

| cite | improve this answer | |

Suppose you put $x$ in the orange square. Then adding up the numbers in the first column gives a square constant of $x+15$. To make the first row work, the number in the upper right-hand corner must be $12.$ Now to compute the northeast-southwest diagonal we may proceed this way. We know two number in the diagonal already, $10$ and $12$. Suppose the central number is $y$ so that the sum of the diagonal elements is $22+y$. This must be equal to the square constant so $22+y=x+15$ and $y=x-7$. That is, the central number is $x-7$.

Now you can figure out all the remaining squares. Eventually you will get an equation you can solve for $x$ because you can compute the value in a square from the sum of the row elements or the sum of the column elements, and these numbers must be the same.

Go for it!

| cite | improve this answer | |
  • $\begingroup$ Why the "northeast-southwest" diagonal the center square must be $x-7$ Is it because $10+12-15=7$ so that is the number that is off from $x$? By trying on my own I've found that I can put $17$ in the second square from the third column, $x-14$ the third square from that third column and $19$ in the third square from the second column. From this I assumed that the diagonal of the square going from northwest to southeast is $3x-21$ and this equated to the other diagonal $x+15$ makes $x=18$. Not sure if this is what goes along your method. $\endgroup$ – Chris Steinbeck Bell Apr 7 '18 at 15:39
  • $\begingroup$ I added some more details to my answer. $\endgroup$ – saulspatz Apr 7 '18 at 15:48
  • $\begingroup$ Funny thing is the same letter you used is what I did in my sketchbook but it looks that I followed your procedure and got to the answer. Do you mind if I borrow your ideas?. I am adding how I got to the solution by following your directions. Out of curiosity I wonder if this method would had worked if let's say the "third number" would had been in the same column of the other two?. Is there a way for such these problems cannot have a solution or many solutions?. Can you enlighten me with that?. $\endgroup$ – Chris Steinbeck Bell Apr 7 '18 at 16:00
  • $\begingroup$ @ChrisSteinbeckBell: If you had three numbers in a row you would know the constant. Say you start with a square with $1,2,3$ down the left column. You know the constant is $6$. You can put $x$ in the top center and $5-x$ in the top right. Then the center gets $x-2$ and we keep going. I haven't finished, but you should. I believe you will find $x$. $\endgroup$ – Ross Millikan Apr 7 '18 at 16:07
  • $\begingroup$ @RossMillikan Thanks for that, but when can say that a magic square cannot be solved or that many solutions can fit?. By the way from your last comment I tried to follow that and I found that $x=4$. I don't know if this can be done mentally but I had to use paint as an aid for calculations. $\endgroup$ – Chris Steinbeck Bell Apr 7 '18 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.