A recent Numberphile video discussed an intriguing unsolved problem in number theory: is there a 3×3 magic square whose entries are all square numbers? (Matt Parker proposed a solution which doesn’t *quite* work: see the video for more. The “Parker square” even has its own Twitter account.)

It turns out that this question leads to some interesting mathematics, which I’m going to have a go at explaining. At the very least I hope to give some insight into why it’s a hard problem.

To reduce the risk that I’ll run out of time and energy before pressing Publish, I’m going to split this post into two or possibly three parts, which I’ll post separately. The first part, which you’re reading **right now**, gives some background on 3×3 magic squares. The second will explain how to find *almost-magic* squares of squares using a bit of number theory and computer algebra. By *almost-magic* I mean that the rows and the columns and *one* of the two diagonals have the same sum.

The third, if I write it, will be more speculative and look at some possible approaches to either finding the mythical square of squares or proving that it doesn’t exist.

On with the first post, then!

It’s going to be easier if we think about almost-magic squares alongside actually-magic squares from the beginning. The starting point for any serious study of 3×3 magic squares is a characterisation attributed to the 19th century Frenchman Édouard Lucas. Considering that magic squares have been studied since antiquity and this is pretty basic algebra, it seems odd that it wasn’t discovered much earlier, but if it was then that seems to have been lost to history.

Anyway, it goes like this. Suppose that the sum of each row and column, and the leading diagonal, is equal to some number *s*. Fill in three of the entries in the square with arbitrary numbers *a*, *b* and *c*, say in the following pattern:

a | b | |

c | ||

Now we have enough information to fill in the rest of the square in a unique way. The sum of the top row is *s*, which means the top-middle cell must equal *s-a-b*:

a | s-a-b | b |

c | ||

The sum of the middle column is also *s*, so the bottom-middle cell is *a+b-c*:

a | s-a-b | b |

c | ||

a+b-c |

Continue like this. Next the leading diagonal:

a | s-a-b | b |

c | ||

a+b-c | s-a-c |

The bottom row:

a | s-a-b | b |

c | ||

2c-b | a+b-c | s-a-c |

The left column:

a | s-a-b | b |

s-a+b-2c | c | |

2c-b | a+b-c | s-a-c |

And finally the right column:

a | s-a-b | b |

s-a+b-2c | c | a-b+c |

2c-b | a+b-c | s-a-c |

If you’ve been paying close attention you have noticed that we haven’t used the rule for the middle row, but if you add up the middle row you can see that it has the right sum anyway. In fact the row and column rules are a little redundant – any five of them imply the sixth – so this isn’t really a surprise.

If we don’t mind our almost-magic squares possibly having repeated or negative entries then we have shown that every choice of *s*, *a*, *b* and *c* gives rise to an almost-magic square, and that every almost-magic square is of this form. For the square to be properly magic the anti-diagonal should also add up to *s*, so we have a magic square if and only if *s* = 3*c*.

Now, observe that these nine entries can be regrouped as three arithmetic progressions with the same common difference *c*–*b*:

a + b – c, |
a, |
a – b + c |

b, |
c, |
2c – b |

s – a + b – 2c, |
s – a – c, |
s – a – b |

In other words, each entry not in the leftmost column is obtained from the one to its left by adding *c*–*b*. And it’s easy to see that the rows are linearly independent. So a 3×3 almost-magic square is simply a rearrangement of three 3-term arithmetic progressions that have the same common difference.

There’s more! If the almost-magic square is actually a magic square, i.e. if *s*=3*c*, then the **columns** of the above are **also** arithmetic progressions, this time with common difference *c*–*a*. So a 3×3 magic square is a rearrangement of three three-term arithmetic progressions with the same common difference *that are themselves in arithmetic progression*.

For example, these three arithmetic progressions have the same common difference, and the columns are arithmetic progressions too:

1, | 2, | 3 |

4, | 5, | 6 |

7, | 8, | 9 |

which means when they’re rearranged they form a magic square:

2 | 9 | 4 |

7 | 5 | 3 |

6 | 1 | 8 |

(You can also use these two diagrams as a handy reminder of how to rearrange your three arithmetic progressions into a magic or almost-magic square.)

So if we want to find an almost-magic square of squares, then all we have to do is to find three different three-term arithmetic progressions of squares that have the same common difference. This is starting to sound like the sort of problem we can Hit With Maths – as indeed it is, which will be the subject of the next post.

Finding an actual 3×3 magic square of squares, on the other hand, seems to be very hard. I suspect there isn’t one, but there isn’t much evidence either way. The best anyone has managed is a single magic square *seven of whose nine entries* are squares, corresponding to the following arithmetic progressions:

23², | 373², | 527² |

205², | 425², | 565² |

289², | 222121, | 360721 |

Christian Boyer is offering €1000 and a bottle of champagne to anyone who can find another that has seven or more squared entries. I surely cannot be the only person who has run fairly extensive – and not entirely naive – computer searches without finding one. If there is one it’s hiding in pretty deep cover.

Pingback: Almost-magic squares of squares | Bosker Blog

Pingback: Squares of squares, and the group of rational points on the circle | Bosker Blog