Off with their heads! When armies get their maths wrong

3 Oct 2016

The Queen of Hearts, still making execution requests, and I... Image: Inga Dudkina/Shutterstock

When the worlds of literature, Disney, and mathematics collide, a most wonderful maths puzzle is created.

We all know the story of Alice in Wonderland: a fantastical world, populated by anthropomorphised flowers and rabbits, full of magical potions and never-ending tea parties. And, of course, insane court battles between children and queens.

What’s a little less well known is the story of what happened in Wonderland after Alice left.

Future Human

You’ll remember the Queen of Hearts’ love of red roses, and you’ll remember her playing card army, determined to make their queen happy by painting all of the white flowers red.

Well, beyond their love of painting, they were also big fans of maths – it got them through the day, in the face of their monarch’s flights of malevolence.

For every ‘off with their heads’ – an instruction now often prefaced by the phrase, ‘in my opinion’ (something the queen had picked up from spending time in the smug, falsely modest, mansplainy area of the internet) – the cards doubled down on their love of maths, always finding new and entertaining ways to fit it into their lives.

Now, some years after Alice had turned her back on Wonderland, the Queen of Hearts had made a couple of new friends, and drawn inspiration from them.

Ahead of a visit from these new friends – chess obsessives the Red Queen and the White Queen – the Queen of Hearts ordered her army to paint a giant red and white board on the grounds.

Not entirely au fait with the ins and outs of chess, the army painted the board in a 9 x 9 pattern, rather than the standard 8 x 8. They also got some of the colouring wrong.

The queen was furious and the standard cry rang forth: “In my opinion, off with their heads!”

But the Red and White queens’ arrival was imminent so the executions were put on hold, for convenience’s sake.

The executions may have been postponed, but the cards’ anxiety was not. So, in order to take their minds off their impending deaths, the cards decided to have a little maths fun with the board.

They would endeavour to fill each of the 81 squares they had made with one of the letters from the acronym IMO (internet slang for ‘in my opinion’) – but, of course, there would be rules:

On each horizontal row and on each vertical row, one-third of the letters must be Is, one-third must be Ms, and one-third must be Os.

Furthermore, on each diagonal line coloured red – like, for instance, the two marked here – one-third of the letters must be Is, one-third must be Ms, and one-third must be Os.

Maths IMO puzzle

They also set themselves the challenge of figuring out whether this same feat would be possible on all similarly coloured boards of a 9k x 9k layout, where k is any positive integer.

What layout of the letters I, M and O did they settle on, and what did they discover about 9k x 9k boards?

Scroll down for the solution to this week’s puzzle.

Maths: Alice in Wonderland playing cards

Image: Morphart Creation/


The playing card army got all of their IMOs in place, thus:

Maths solution

When it came to their thought experiment on 9k x 9k boards, the playing cards started with the simple premise that a 9x 9k board is made of k2 of 9 x 9.

By gluing together k2 tables like the one above, we get a 9x 9k board. For example, if k=2, we put together four boards like the one above to get:

Maths solution expanded board

The rows of the larger 9x 9k boards are made by putting together the rows of k boards of size 9 x 9.

The number of Is in a row of the 9x 9k board is the sum of the number of Is in k rows of 9 x 9. This pattern holds for the Os and Ms.

If the Is, Io and Ms are equally distributed inside the rows of the 9 x 9 board, they will thus be equally distributed inside the rows of the 9k x 9k board.

The same argument holds true for the diagonals, too.

This week’s maths puzzle comes courtesy of Dr Anca Mustata, lecturer in Mathematics at UCC, who is actively involved in the Maths Circles initiative, the Mathematics Enrichment programme in UCC and the Irish Mathematical Olympiad.

Kirsty Tobin was careers editor at Silicon Republic