A magic square is a square with side 3 consisting of 9 unit squares, such that the numbers written in the unit squares (one number in each square) satisfy the following property: the sum of the numbers in each row is equal to the sum of the numbers in each column and is equal to the sum of all the numbers written in any of the two diagonals. A rectangle with sides $m\ge3$ and $n\ge3$ consists of $mn$ unit squares. If in each of those unit squares exactly one number is written, such that any square with side $3$ is a magic square, then find the number of most different numbers that can be written in that rectangle.
Problem
Source: Macedonia National Olympiad 2016
Tags: combinatorics
03.07.2016 17:42
I think the answer is 9, for all dimensions of the rectangle:
26.03.2017 03:22
I might be wrong but I think the answer is $9$ for $m = n = 3$ and $1$ for $m>3$ or $n>3$. If $m = n = 3$ then the example is well known and we have that the answer is $9$. Otherwise the answer is $1$. Indeed, note that if we have a rectangle that satisfies the condition of the problem we can subtract a constant from every unit square and the rectangle will still satisfy the condition. We can assume without loss of generality that a $0$ is written in the upper left corner of the rectangle. Now if $(i,j)$ is the number in the $i$-th row and $j$-th column with $(1,1)$ being the upper left corner, we will denote: $(1,3) = a$, $(3,1) = b$, $(2,2) = d$ and $(3,3) = c$. Assuming that $(1,1)$ is $0$ using the $9$ equations the upper left magic square gives we calculate the following: $(1,1) = 0$, $(1,2) = \frac{a+3b}{2}$, $(1,3) = a$ $(2,1) = \frac{3a+b}{2}$, $(2,2) = \frac{a+b}{2}$, $(2,3) = \frac{-a+b}{2}$ $(3,1) = b$, $(3,2) = \frac{a-b}{2}$, $(3,3) = a+b$ Now if we assume WLOG that the number of columns $n \ge 4$ we have $((1,1)+(1,2)+(1,3)=(1,2)+(2,2)+(3,2)=(1,4)+(1,3)+(1,2))$ so $(1,1) = (1,4) = 0$. Now $\frac{3a+3b}{2} = (1,2) + (1,3) + (1,4) = (3,2) + (2,3) + (1,4) = 0$ so $a = -b$. Plugging $a = -b$ in $(1,2) + (2,3) + (3,4)$ gives $-3a = 0$ so $a = b = 0$. Now it's easy to see that all numbers must be $0$ so all the numbers must originally have been equal to some constant $k$. It's easy to see that such a rectangle satisfies the condition of the problem.