# “Magic matrix” formula inaccuracy

I was reading Martin Gardner's "hexaflexagons and other mathematical diversions" in which he describes a magic matrix - a different type of magic square in which all numbers of different rows and columns add up to the "magic number" he explains the method behind it:

Like most tricks, this one is absurdly simple when explained. The square is nothing more than an old-fashioned addition table, arranged in a tricky way. The table is generated by two sets of numbers. The sum of these numbers is the magic number. If you write the first set of numbers horizontally above the top row of the square, and the second set vertically beside the first column, you can see at once how the numbers in the cells are determined.

As you can see if you pick any four numbers from different rows and columns, they will add up to $34$. He further provides a formula to calculate the "magic number" of a magic matrix:

One of the simplest ways to form an addition table on a square matrix is to start with 1 in the upper left corner, then continue from left to right with integers in serial order. A four-by-four matrix of this sort becomes an addition table for the two sets of numbers $1, 2, 3, 4$ and $0, 4, 8, 12$ (above). This matrix will force the number $34$. The forced number is of course a function of the size of the square. If $n$ is the number of cells on a side, then the forced number will be

On squares with an odd number of cells on the side, this forced number will equal the product of n and the number on the center cell. If you start with a number higher than $1$ (call it $a$) and continue in serial order, the forced number will be

Usually this formula is accurate, however with a $2*2$ grid starting with $2$ the formula produces:

$$\frac{ 2 ^ 3 + 2 }{ 2 } + 2 \cdot ( 3 - 1 ) = 9$$

Whilst the actual result is $8$

Can anyone shed some light on this?

• The formula would be $$\frac{2^3+2}{2} + 2\cdot (2-1),$$ which produces the correct $7$. If you start with $3$, the forced number is indeed $9$. – Daniel Fischer Dec 18 '13 at 16:08
• @DanielFischer no, the result is 8 not 7, which makes it still inaccurate. and it is the highest number not the lowest as can be seen with ( 2 ^ 3 + 2 ) / 2 + ( 2 * ( 4 - 1 ) ) = 11 (the correct formula for a 2*2 staring with three) – Math chiller Dec 18 '13 at 16:22
• $$\begin{bmatrix}2&3\\4&5 \end{bmatrix}$$ $2 + 5 = 7 = 3+4$. – Daniel Fischer Dec 18 '13 at 16:28
• No, the formula is for successive numbers, so starting with $2$ on a $2\times 2$ grid you get the numbers $2,3,4,5$. – Daniel Fischer Dec 18 '13 at 16:31
• @DanielFischer thank you, makes sense now, could you please put that in a answer? – Math chiller Dec 18 '13 at 16:33

The given formula is for grids filled with successive numbers only, so the $2\times 2$ grid starting with $a$ is

$$\begin{bmatrix}a & a+1\\ a+2 & a+3 \end{bmatrix}$$

with the sum $2a + 3 = 5 + 2(a-1) = \frac{2^3+2}{2} + 2(a-1)$.

If you fill your grid following a different rule,

$$\begin{bmatrix} a & a+h & \dotsb & a + (n-1)h\\ a+v & a+v+h & \dotsb & a+v + (n-1)h\\ \vdots & \vdots &\ddots &\vdots\\a+(n-1)v & a+(n-1)v+h &\dotsb & a+(n-1)v+(n-1)h \end{bmatrix}$$

$$n\cdot a + \frac{n(n-1)}{2}(h+v).$$
For the successive numbers, we have $h = 1$ and $v = n$, so that produces
$$n\cdot a + \frac{n(n-1)(n+1)}{2} = n\cdot a + \frac{n^3-n}{2} = \frac{n^3+n}{2} + n\cdot (a-1).$$