# Given a number $11 \leqslant n\leqslant 99$, how to write a couple of numbers which total to $n$

Yesterday, a friend of mine asked me for a number between 11 and 99 (not 100% sure about the boundaries). I had no idea what he was up to and called 38, about half a minute later he had written down the following:

$$\begin{pmatrix} 18 & 1 & 12 & 7\\ 11&8&17&2\\5&10&3&20\\4&19&6&9 \end{pmatrix}$$

At first, I thought it was already pretty impresive that all rows, columns and the two diagonals sum up to 38. Then he showed me that also the four 2x2 squares in the corners sum up to 38, and so do

$$\begin{pmatrix} 1 & 12\\ 8 & 17 \end{pmatrix}, \begin{pmatrix} 8 & 17 \\ 10 & 3 \end{pmatrix} \text{ and } \begin{pmatrix} 10 & 3\\ 19 & 6 \end{pmatrix}.$$

Does this "thing" have a name? How does one produce such a matrix in such a short amount of time?

-
These are called "magic squares" and there are some constructions given at the wikipedia article. –  Cocopuffs Jul 20 '12 at 14:13
A wild idea came to my mind after reading your question: did you ask your friend?? –  DonAntonio Jul 20 '12 at 14:15
Hint, replace 17 through 20 by 13 through 16 in your matrix. –  peoplepower Jul 20 '12 at 14:16
@DonAntonio: He always impresses me with some "magic" in any possible way when we meet and for the last six years he would never explain anything. :) –  Huy Jul 20 '12 at 14:19
I see, @Huy, but unless your friend does that for a living or unless he's working in a very secret proyect, I can't understand the reason for his teasing. Mathematicians don't usually conceal the reasoning behind their stuff (au contraire!)...well, perhaps he isn't a mathematician. –  DonAntonio Jul 20 '12 at 14:44