5. We need to fill a $3 \times 3$ table with nine given numbers such that in each row and column, the largest number is the sum of the other two. Determine whether it is possible to complete this task with the numbers

a) 1, 2, 3, 4, 5, 6, 7, 8, 9;

b) 2, 3, 4, 5, 6, 7, 8, 9, 10.

If yes, find out how many ways the task can be completed such that the largest number is in the center of the table.

(Jaromír Šimša)
SOLUTION. The sum of the numbers in each row (and in each column) is even, equaling twice the largest of the three written numbers. Therefore, the sum of all the numbers in the table must also be even. Since in case a) the sum of the numbers is 45, the task cannot be completed.

Since the sum of the numbers in case b) is even $(10 \cdot 11 / 2 - 1 = 54)$, we will try to fill the table in the required manner. Among the nine given numbers, there are five even numbers (which we will denote by the symbol $S$) and four odd numbers (which we will denote by the symbol $L$). Symbolically, then, in each row and column, one of the equations $S = L + L$, $S = S + S$, or $L = S + L$ must hold. If we look at the number of even and odd numbers used in these equations and also consider that we must use more even numbers than odd ones, we conclude that at least one row and one column must be of the type $S = S + S$.

We can swap the rows of our table among themselves without violating the condition given in the problem. The same applies to the columns. We can therefore assume that both the first row and the first column contain only even numbers (they are of the type $S = S + S$). Let's look at their common cell (the top left corner of the table), in which one of the numbers $2, 4, 6, 8$, or $10$ must be written.

We will list for each of the five candidates all the suitable equations to meet the condition of the problem for the first column and the first row:

$$
\begin{gathered}
2 = 6 - 4 = 8 - 6 = 10 - 8, \quad 4 = 6 - 2 = 10 - 6, \quad 6 = 2 + 4 = 8 - 2 = 10 - 4, \\
8 = 2 + 6 = 10 - 2, \quad 10 = 8 + 2 = 6 + 4 .
\end{gathered}
$$

We see that only the numbers 4 and 8 cannot be written in two "disjoint" ways, so in the common cell, one of the numbers 2, 6, or 10 must be written, and the table must then be (up to the order of rows, columns, and possibly flipping along the diagonal) filled with even numbers in one of three ways (asterisks here denote the four odd numbers $3, 5, 7, 9$ written in some order), which we will further examine:

| 2 | 8 | 10 |
| :---: | :---: | :---: |
| 4 | $*$ | $*$ |
| 6 | $*$ | $*$ |

Type A

| 6 | 2 | 8 |
| :---: | :---: | :---: |
| 4 | $*$ | $*$ |
| 10 | $*$ | $*$ |

Type B

| 10 | 4 | 6 |
| :---: | :---: | :---: |
| 2 | $*$ | $*$ |
| 8 | $*$ | $*$ |

Type C

In the table of type A, we would have to have $8 = 3 + 5$ and $10 = 3 + 7$ in the 2nd and 3rd columns, but the number 3 cannot be in both columns, so the required filling of the table of type A does not exist.

In the table of type B, we have the numbers 8 and 10 again in the 3rd row and 3rd column, and from the already mentioned equations, we see that the table can be completed in only one suitable way

| 6 | 2 | 8 |
| :---: | :---: | :---: |
| 4 | 9 | 5 |
| 10 | 7 | 3 |$\rightarrow$| 2 | 6 | 8 |
| :---: | :---: | :---: |
| 7 | 10 | 3 |
| 9 | 4 | 5 |

We have already transformed the table (by first swapping the first column with the second and then the second row with the third) into one of the possible forms where the number 10 stands in the middle of the table, as required by the problem.

Finally, in the table of type C, we have only one way to express $8 = 5 + 3$ in the 3rd row and $6 = 9 - 3$ in the 3rd column. This determines the position of not only the numbers 3, 5, and 9, but also the remaining number 7. The resulting table clearly does not meet the problem's requirements.

It remains to determine the number of different tables that can be created from the filled table of type B so that the number 10 is in the middle. In the middle row or column, along with 10, there must be the numbers 6 and 4, or 7 and 3, respectively, so we have a total of $4 \cdot 2 = 8$ possibilities (we place the 6 in one of the four fields adjacent to the middle 10, the 4 will then be in the opposite field, the 7 will be placed in one of the two remaining fields adjacent to the 10; the numbers in the corner fields are then uniquely determined).