[Math] What method can be used to solve a magic square problem without just guessing

algebra-precalculusarithmeticmagic squarerecreational-mathematics

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?

Best Answer

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.

so:

$$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:

$$12+10=22$$

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.

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

$$a=17$$

$\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:

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

$$a=19$$

$\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:

$$12+17+a=x+15$$

$$a=x+3-17$$

$$a=x-14$$

$\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

$$x+x-7+x-14=12+10+x-7$$

$$2x-14=22$$

$$2x=36$$

$$x=18$$

Therefore by replacing in the figure we get to:

Since all the sums check:

$$18+3+12=15+18=33$$

$$5+11+17=16+17=33$$

$$10+19+4=29+4=33$$

$$18+5+10=23+10=33$$

$$3+11+19=14+19=33$$

$$12+17+4=12+21=33$$

Then both diagonals

$$18+11+4=29+4=33$$

$$12+11+10=12+21=33$$

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.