2011
04.06

## Magic Square

This week El Pais’ math challenge was easier to solve than previous ones (maybe that’s why I resolved it without using the computer this time :D).

The problem is the following: get a product magic square, that is, a 3×3 square whose product for numbers in every row, column or diagonal gives the same (unknown) amount . All numbers are unrepeated positive integers. It’s known that the number in the center cell is 15.

My approach was to assign each cell a variable name:

 $$a$$ $$b$$ $$c$$ $$d$$ $$15$$ $$f$$ $$g$$ $$h$$ $$i$$

This way I got equations like:
\begin{aligned} a * b * c = a * d * g \\ a * b * c = a * 15 * i \\ a * b * c = d * 15 * f \\ a * d * g = g * h * i \\ \end{aligned}
which allow some terms to be cancelled and, after some operations, I got the following magic square (or the like, rotations are equivalents):

 $$\frac{15^3}{b·c}$$ $$b$$ $$c$$ $$\frac{b·c^2}{15^2}$$ $$15$$ $$\frac{15^4}{b·c^2}$$ $$\frac{15^2}{c}$$ $$\frac{15^2}{b}$$ $$\frac{b·c}{15}$$

Now we se that the product of any row, column or diagonal gives the same result (as requested), and that such result is 15^3 = 3375. This was the unknown product. Even more, since cells can only have positive integers, the number of possible solutions is finite (in fact unique if rotations are excluded). We can also see that both b and c must be a factor of 15^2, or in other words, both b and c must be one of [1, 3, 5, 3^2, 3 * 5 (already in the center), 5^2, 3^2 * 5, …]. That is every possible combination of possible product of 3^x * 5^y (with both x and y being [0, 1, 2, 3]). There are 16 possible combinations. Let’s start supposing b = 1, then the resulting square is:

 $$\frac{15^3}{c}$$ $$1$$ $$c$$ $$\frac{c^2}{15^2}$$ $$15$$ $$\frac{15^4}{c^2}$$ $$\frac{15^2}{c}$$ $$15^2$$ $$\frac{c}{15}$$

Right-lowest cell reveals that 15 must be a factor of c (and c cannot be 15, because it’s already used in the center). The lowest left-most cell also tell us that c is a factor of 15^2 (which is 3^2 * 5^2). This means c must be a product of 3 or 9 per 5 or 25 (only 3 combinations possible, since 3 * 5 = 15 which has been discarded). I tried with 9 * 5 = 45 and… eureka! c = 45. I replaced c by its value and this is the magic square:

 $$75$$ $$1$$ $$45$$ $$9$$ $$15$$ $$25$$ $$5$$ $$225$$ $$3$$