# Solve the magic square

My friend gave me the following magic square to solve

$$\begin{bmatrix}\frac23&5&?\\\frac19&?&?\\?&?&?\end{bmatrix}$$ I can solve it. Can you?

You must provide logical reasoning in your answer to get the green checkmark.

First I'll prove a property of $$3\times3$$ magic squares.

The centre cell must contain a value of one third of the magic constant $$c$$. This is proved by adding together the four lines through the centre: $$4c = (v_1+v_5+v_9)+(v_2+v_5+v_8)+(v_3+v_5+v_7)+(v_4+v_5+v_6)\\= (v_1+v_2+v_3)+(v_4+v_5+v_6)+(v_7+v_8+v_9)+3v_5 \\= 3c+3v_5$$ $$v_5=\frac{c}{3}$$ where $$v_1$$ to $$v_9$$ are the values in the nine cells.

Using this property you can use a similar proof to find the central cell in this case:

$$3v_5 = c\\= (v_1+v_2+v_3)+(v_1+v_4+v_7)-(v_3+v_5+v_7)\\ = 2v_1+v_2+v_4-v_5$$ $$4v_5=2v_1+v_2+v_4 = 2\cdot\frac23 + 5 + \frac19=\frac{58}{9}$$ $$v_5=\frac{29}{18}$$ Which also means that the magic sum is $$c=3v_5=\frac{29}{6}$$

The rest of the magic square then follows:

$$\frac{1}{18}\begin{bmatrix}12 & 90 & -15\\ 2 & 29 & 56\\ 73 & -32 & 46\end{bmatrix}$$ or in lowest terms: $$\begin{bmatrix} \frac23 & 5 & -\frac56 \\ \frac19 & \frac{29}{18} & \frac{28}9 \\ \frac{73}{18} & -\frac{16}9 & \frac{23}9 \end{bmatrix}$$

I originally used a less elegant more general method by finding a generic solution:

Fill the following three cells using three variables: $$\begin{bmatrix}a+b&.&a+c\\.&a&.\\.&.&.\end{bmatrix}$$ We know each line adds to $$3a$$, and this determines the rest of the cells, resulting in a parameterised general solution: $$\begin{bmatrix}a+b&a-b-c&a+c\\a-b+c&a&a+b-c\\a-c&a+b+c&a-b\end{bmatrix}$$

Now it is just a matter of applying that to this particular problem.

We get a system of 3 equations: $$a+b =\frac{2}{3}\\a-b-c=5\\a-b+c=\frac{1}{9}$$ which solves to $$a = \frac{29}{18}\\b =-\frac{17}{18}\\c =-\frac{22}{9}$$ giving the magic square we found before.

• Correct. But can you find any other ways to do this? I will give you the checkmark if you find a more elegant solution. Remember the row sum is equals to triple of the center number.(+1) – Culver Kwan Jul 30 '20 at 6:12
• Why is the row sum equal to the triple of the centre number? – George Menoutis Jul 30 '20 at 6:27
• @GeorgeMenoutis: Basic property of magic squares. If you add the entries in the two diagonals, the center row and center column, you get 4 times the row sum. But this can also be written as the sum of all entries in the square plus 3 times the center entry. The sum of all entries is 3 times the row sum, and the result comes from equating these two counts. – Jeremy Dover Jul 30 '20 at 10:08

The most elegant solution I could find was this one: let the matrix be

$$\begin{equation*} \begin{pmatrix} A & B & C \\ D & E & F \\ G & H & I \end{pmatrix} \end{equation*}$$

Let the sum of each row/column/diagonal be $$S$$. Then

$$\begin{eqnarray} A+B+C + D+E+F = A+E+I + C+F+I = 2S &\to& I = \frac{B+D}{2} \\ A+D+G = G+H+I + S &\to& H = A+D-I\\ A+B+C = C+F+I = S &\to& F = A+B-I \end{eqnarray}$$

This immediately gives us values for $$F,H,I$$. We know the sum of $$C+E$$ and also the difference $$C-E$$ because

$$\begin{eqnarray} A+D+G=C+E+G &\to& C+E = A+D \\ A+B+C=B+E+H &\to& C-E = H-A \end{eqnarray}$$

Therefore we know the values of C,E and hence G. This yields the same as Jaap's solution.

• By symmetry the formula for $I$ also gives you $C=\frac{D+H}{2}$ and $G=\frac{B+F}{2}$, which simplifies the second part. – Jaap Scherphuis Jul 30 '20 at 8:03
• Interesting property for 3x3 magic squares, I = (B+D)/2. Thanks. – Florian F Aug 1 '20 at 0:17