How many $4\times4$ normal magic squares have all subsquares sum to the magic constant

magic squarematricesrecreational-mathematics

How many essentially distinct normal $4\times4$ magic squares have all $2\times2$ subsquares sum to the magic constant?


Relevant information

I apologize if this basic question has already been asked here before. A $4\times4$ most-perfect magic square is a magic square which is normal (contains the integers $1,2,3,…,16$) and for which:

$(1)$ All pairs of integers distant by $2$ positions along any diagonal sum to $17$, and

$(2)$ Each of the $9$ $2\times2$ subsquares sums to the magic constant ($34$)

I want to know how many $4\times4$ magic squares satisfy property $(2)$ with or without $(1)$. Wikipedia says there are $48$ unique most-perfect $4\times4$ magic squares. It also says that all $4\times4$ panmagic squares (magic square where the broken diagonals all add up to the magic constant) are most-perfect (and obviously all most-perfect squares are panmagic), but I'm not sure if there are $4\times4$ magic squares that satisfy $(2)$ but are not panmagic. I have tried (and failed) to produce such a square by hand. An example of a $4\times4$ magic square satisfying $(2)$ is shown below.


Thus my question is: How many essentially distinct normal $4\times4$ magic squares are there that satisfy $(2)$? Are there only $48$ (the most-perfect/panmagic squares) or are some such squares not most-perfect/panmagic?

$4\times4$ most-perfect magic square:

$\hskip2in$Magic square

Best Answer

After some further thought, I've realised why Joriki's answer is correct (i.e. why all $4\times4$ magic squares satisfying $(2)$ are panmagic and most-perfect). It's too long to put in a comment, so I've put it in an answer here.


1. $(2)$ implies panmagicness

Let us take an arbitrary magic square satisfying property $(2)$ and label the elements $a_{m,n}$ where $m\in\{0,1,2,3\}$ is the row number and $n\in\{0,1,2,3\}$ is the column number.

By the definition of a magic square, we have:

$$\sum_{k=0}^3 a_{k,n}=34~~~~\forall n$$ $$\sum_{k=0}^3 a_{m,k}=34~~~~\forall m$$ $$\sum_{k=0}^3 a_{k,k}=34$$ $$\sum_{k=0}^3 a_{k,4-k}=34$$

The first observation is that if $(2)$ holds for all $9$ subsquares, then it also holds for every 'broken' subsquare that wraps around the edges and corners. To see this, extend the square like a torus, to fill an infinite two-dimensional grid with repeating copies of the original magic square (so that for instance $a_{0,3}$ occurs to the left of $a_{0,0}$ and so on). Then obviously all $2\times2$ subsquares that are wholly within each copy of the original square sum to $34$.

First we consider $2\times2$ subsquares that only wrap around one edge between adjacent magic squares (e.g. $a_{0,0},a_{0,1},a_{3,0},a_{3,1}$ or $a_{1,0},a_{2,0},a_{1,3},a_{2,3}$). Without loss of generality, let this be a horizontal edge. Without loss of generality, let this subsquare be $a_{0,0},a_{0,1},a_{3,0},a_{3,1}$. Then by $(2)$ we have $a_{0,0}+a_{0,1}+a_{1,0}+a_{1,1}=a_{1,0}+a_{1,1}+a_{2,0}+a_{2,1}=a_{2,0}+a_{2,1}+a_{3,0}+a_{3,1}=34$, and if we subtract the centre square from the sum of the two other squares we see that: $$a_{0,0}+a_{0,1}+a_{3,0}+a_{3,1}\\=a_{0,0}+a_{0,1}+a_{1,0}+a_{1,1}-a_{1,0}-a_{1,1}-a_{2,0}-a_{2,1}+a_{2,0}+a_{2,1}+a_{3,0}+a_{3,1}=34$$ This argument may be generalized to show that any $2\times2$ subsquare wrapping around a single horizontal or vertical edge of the magic square has sum $34$.

There is a single $2\times2$ subsquare wrapping around both horizontal and vertical edges, namely $a_{0,0},a_{0,3},a_{3,0},a_{3,3}$. It follows from our previous result and from the fact that the sum of each row is $34$ that: $$a_{0,0}+a_{0,3}+a_{3,0}+a_{3,3}\\=a_{0,0}+a_{0,1}+a_{0,2}+a_{0,3}+a_{3,0}+a_{3,1}+a_{3,2}+a_{3,3}-(a_{0,1}+a_{0,2}+a_{3,1}+a_{3,2})\\=34+34-34=34$$

Thus if all $9$ $2\times2$ subsquares sum to $34$, then every $2\times2$ subsquare on our infinite grid of copies of the magic square sums to $34$. This can be stated:

$$a_{j\pmod 4,k\pmod4}+a_{j\pmod 4,k+1\pmod4}+a_{j+1\pmod 4,k\pmod4}+a_{j+1\pmod 4,k+1\pmod4}=34~~~\forall j,k$$

Now note that: $$a_{j\pmod 4,k\pmod4}+a_{j\pmod 4,k+1\pmod4}+a_{j+1\pmod 4,k\pmod4}+a_{j+1\pmod 4,k+1\pmod4}=34=a_{j+1\pmod 4,k\pmod4}+a_{j+1\pmod 4,k+1\pmod4}+a_{j+2\pmod 4,k\pmod4}+a_{j+2\pmod 4,k+1\pmod4}$$

This demonstrates the first of the following $2$ identities:

$$a_{j\pmod 4,k\pmod4}+a_{j\pmod 4,k+1\pmod4}\\=a_{j+2\pmod 4,k\pmod4}+a_{j+2\pmod 4,k+1\pmod4}~~~\forall j,k\tag{c}$$ $$a_{j\pmod 4,k\pmod4}+a_{j+1\pmod 4,k\pmod4}\\=a_{j\pmod 4,k+2\pmod4}+a_{j+1\pmod 4,k+2\pmod4}~~~\forall j,k\tag{d}$$

The second identity follows by an analogous argument. Now note that: $$a_{j\pmod 4,k\pmod4}+a_{j+1\pmod 4,k\pmod4}\\=a_{j\pmod 4,k+2\pmod4}+a_{j+1\pmod 4,k+2\pmod4}~~~\forall j,k$$ and $$a_{j+1\pmod 4,k\pmod4}+a_{j+2\pmod 4,k\pmod4}\\=a_{j+1\pmod 4,k+2\pmod4}+a_{j+2\pmod 4,k+2\pmod4}~~~\forall j,k$$ Therefore: $$a_{j+1\pmod 4,k\pmod4}=a_{j\pmod 4,k+2\pmod4}+a_{j+1\pmod 4,k+2\pmod4}-a_{j\pmod 4,k\pmod4}\therefore~~a_{j\pmod 4,k+2\pmod4}+a_{j+1\pmod 4,k+2\pmod4}-a_{j\pmod 4,k\pmod4}+a_{j+2\pmod 4,k\pmod4}\\=a_{j+1\pmod 4,k+2\pmod4}+a_{j+2\pmod 4,k+2\pmod4}$$ Which implies: $$a_{j\pmod 4,k\pmod4}+a_{j+2\pmod 4,k+2\pmod4}\\=a_{j\pmod 4,k+2\pmod4}+a_{j+2\pmod 4,k\pmod4}~~~\forall j,k$$ In other words, for every $3\times3$ subsquare, the pairs of diagonally opposing corners have the same sum.

We may now prove that the square is panmagic. This is equivalent to showing that the following two equations hold: $$a_{j\pmod 4,k\pmod4}+a_{j+1\pmod 4,k+1\pmod4}\\+a_{j+2\pmod 4,k+2\pmod4}+a_{j+3\pmod 4,k+3\pmod4}=34~~~\forall j,k\tag{a}$$ $$a_{j\pmod 4,k+3\pmod4}+a_{j-1\pmod 4,k+2\pmod4}\\+a_{j-2\pmod 4,k+1\pmod4}+a_{j-3\pmod 4,k\pmod4}=34~~~\forall j,k\tag{b}$$ Without loss of generality, we will prove $(a)$ and $(b)$ for $j=0$ and the method of proof will easily generalize to other $j$. Thus we need to show: $$a_{0,k\pmod4}+a_{1,k+1\pmod4}+a_{2,k+2\pmod4}+a_{3,k+3\pmod4}=34~~~\forall k\tag{a*}$$ $$a_{0,k+3\pmod4}+a_{1,k+2\pmod4}+a_{2,k+1\pmod4}+a_{3,k\pmod4}=34~~~\forall k\tag{b*}$$ Both identities hold for $k=0$ by the definition of a magic square. But for every $3\times3$ subsquare, the pairs of diagonally opposing corners have the same sum, so we have that: $$a_{0,0}+a_{1,1}+a_{2,2}+a_{3,3}=34\\\therefore~~a_{0,2}+a_{1,3}+a_{2,0}+a_{3,1}=34$$ which implies $(a*)$ for $k=2$. Analogously, $(b*)$ holds for $k=2$. But similar reasoning shows: $$a_{0,3}+a_{1,2}+a_{2,1}+a_{3,0}=34\\\therefore~~a_{0,1}+a_{1,2}+a_{2,3}+a_{3,0}=34$$ which implies $(a*)$ for $k=1$. Similarly, $$a_{0,3}+a_{1,2}+a_{2,1}+a_{3,0}=34\\\therefore~~a_{0,3}+a_{1,0}+a_{2,1}+a_{3,2}=34$$ which implies $(a*)$ for $k=3$. Analogous reasoning demonstrates $(b*)$ for $k=1,3$. Our result may trivially be extended to other $j$ to demonstrate that $(a)$ and $(b)$ hold which implies that our square is panmagic.

Thus every $4\times4$ normal magic square whose $9$ $2\times2$ subsquares sum to $34$ is panmagic.


2. Panmagicness implies $(2)$

Before we demonstrate that every panmagic square satisfies $(1)$ let us show that all panmagic squares satisfy $(2)$ which will enable us to understand the unproved assumption in the question that all panmagic squares are most-perfect.

Let us pick an arbitrary $4\times4$ normal magic square which is panmagic (i.e. satisfies $(a)$ and $(b)$). We simply need to demonstrate that the $9$ $2\times2$ subsquares sum to $34$.

Applying $(a)$ and $(b)$ allows us to deduce that:

$$a_{0,0}+a_{0,1}+a_{1,0}+a_{1,1}+a_{2,2}+a_{2,3}+a_{3,2}+a_{3,3}\\=a_{0,0}+a_{1,1}+a_{2,2}+a_{3,3}+a_{0,1}+a_{1,0}+a_{2,3}+a_{3,2}=34+34$$

Similarly applying the row property of a magic square we have trivially that:

$$a_{0,0}+a_{0,1}+a_{1,0}+a_{1,1}+a_{0,2}+a_{0,3}+a_{1,2}+a_{1,3}=34+34$$

This implies that:

$$a_{0,0}+a_{0,1}+a_{1,0}+a_{1,1}+a_{0,2}+a_{0,3}+a_{1,2}+a_{1,3}\\=a_{0,0}+a_{0,1}+a_{1,0}+a_{1,1}+a_{2,2}+a_{2,3}+a_{3,2}+a_{3,3}\\\therefore a_{0,2}+a_{0,3}+a_{1,2}+a_{1,3}=a_{2,2}+a_{2,3}+a_{3,2}+a_{3,3}$$

But the column property of magic squares trivially gives us:

$$a_{0,2}+a_{0,3}+a_{1,2}+a_{1,3}+a_{2,2}+a_{2,3}+a_{3,2}+a_{3,3}=34+34$$

enabling us to conclude that: $$a_{0,2}+a_{0,3}+a_{1,2}+a_{1,3}=34$$

A directly analogous process enables us to show that each of the $4$ corner $2\times2$ subsquares sums to $34$. It is a simple exercise to extend this same reasoning to each of the other $5$ subsquares using the translational symmetry of the panmagic square in the toroidal grid.

Thus every $4\times4$ panmagic square satisfies $(2)$, which implies in conjunction with our previous result that a $4\times4$ normal magic square is panmagic $\text{iff}$ it satisfies $(2)$.


3. $(2)$ implies $(1)$

We must now prove that every square satisfying $(2)$ also satisfies $(1)$. First note that because the square is of size $4$, for any $a_{m,n}$ there exists a unique element $p(a_{m,n})=a_{m+2\pmod 4,n+2\pmod4}$ located $2$ squares away diagonally in any direction. For any $a_{m,n}$, define $s(a_{m,n})=a_{m,n}+p(a_{m,n})$.

Now by the definition of a magic square we have:

$$a_{0,0}+a_{0,1}+a_{0,2}+a_{0,3}=34$$

But applying $(c)$ followed by our result that for every $3\times3$ subsquare, the pairs of diagonally opposing corners have the same sum, we deduce that:

$$a_{0,0}+a_{2,1}+a_{2,2}+a_{0,3}=34\\\therefore a_{0,0}+a_{2,3}+a_{2,2}+a_{0,1}=34\\\therefore s(a_{0,0})+s(a_{0,1})=34$$

Let $s(a_{0,0})=x$ and $s(a_{0,1})=y$ (so $x+y=34$). We can easily generalize this to show: $$s(a_{m,n})+s(a_{m,n+1})+34$$

Now this implies that: $$s(a_{0,3})+s_(a_{0,0})=34=s(a_{0,0})+s_(a_{0,1})\\\therefore s(a_{0,3})=y$$

and similarly we may show that $s(a_{0,2})=x$.

But by definition $s(a_{m,n})=s(p(a_{m,n}))$ so it follows that $s_{2,0}=x$, $s_{2,1}=y$, $s_{2,2}=x$, and $s_{2,3}=y$.

Using the column property of magic squares we have that: $$a_{0,0}+a_{1,0}+a_{2,0}+a_{3,0}=34$$

and using an analogous process to the above it is easy to show that: $$a_{0,0}+a_{1,0}+a_{2,2}+a_{3,2}=34$$

from which we may deduce that $s(a_{1,0})=y$, and this enables us to deduce similarly to the above that $s(a_{1,1})=x$, $s(a_{1,2})=y$, $s(a_{1,3})=x$, $s(a_{3,0})=y$, $s(a_{3,1})=x$, $s(a_{3,2})=y$, and $s(a_{3,3})=x$.

But we may use the diagonal property of the magic square to deduce that:

$$2a_{0,0}+2a_{1,1}+2a_{2,2}+2a_{3,3}=34+34\\\therefore s(a_{0,0})+s(a_{1,1})+s(a_{2,2})+s(a_{3,3})=34+34\\\therefore 2x=34\\\therefore x=y=17\\\therefore s(a_{m,n})=17~~~\forall m,n$$

This is equivalent to $(1)$ and proves that every panmagic $4\times4$ square satisfies $(1)$.

The converse is trivial to show: if a $4\times4$ normal magic square satisfies $(1)$ then it is panmagic


Thus we have proved the following:

  1. A $4\times4$ normal magic square is panmagic $\text{iff}$ all $9$ subsquares sum to $34$
  2. A $4\times4$ normal magic square is panmagic $\text{iff}$ all pairs of squares distant by $2$ along any diagonal sum to $17$

We have therefore shown that the set of all $4\times4$ normal magic squares satisfying $(1)$, the set of all $4\times4$ normal magic squares satisfying $(2)$, the set of all $4\times4$ panmagic squares, and the set of all $4\times4$ most-perfect squares (those satisfying $(1)$ and $(2)$) are identical, and as Joriki kindly demonstrated, there are $48$ of these.