The Problem Of The Nine-Coloured Cube

By way of @ajk_44 at NRICH, a belter of a puzzle:

You have 27 small cubes - three each of nine distinct colours. Can you arrange them in a cube so that each colour appears once on each face?

(Alison has created a Geogebra widget for you to play with, should you want to do that before reading on to the spoilers below the line.)


Before anything else, let's get our terms straight. The 27 cubes can be grouped into four classes: vertices, of which there are eight; edges, of which there are 12; centres, of which there are six; and one in the very middle.

I'll also label the six faces front, back, left, right, top and ground (rather than bottom, so that they all have different initial letters.)

"It can't possibly be done!"

My first systematic thought was "what happens if I put this colour in one of the corners? Where can its friends go?"

The answer to that is "not in many places." The corner lies on three faces, leaving only eight possible places for the remaining two cubes to go - three centres, four edges and the middle.

Here, I blundered: I reckoned that the only possible way to pick two of those eight without a clash on any face was one on an edge and one at a centre - and given that there are only six centres available, it couldn't possibly be done. There would be two corners left over.

Hang on a second

What about the middle? The middle could be the same colour as two opposite corners, and this would solve that counting problem: two of the eight corners could be the same colour, and the remaining six would all be different colours.

We'd also use up six of the edges, leaving six more unspecified. That works out as two per face (because each edge lives on two sides), and I'd hope to be able to colour those appropriately.

Making it work

I did do this using the widget, but I think it might be clearer and easier to follow1 using numbers on a grid. Throughout, the left-hand grid represents the ground layer and the right-hand grid the top layer. The middle one, unsurprisingly, is in between. The left- and right-most columns of each grid are the left and right faces, and the top and bottom rows the back and front faces, respectively.

The first step is to put the middle in place, with its two friends arranged in opposite corners:

1 - -    - - -    - - -
- - -    - 1 -    - - -
- - -    - - -    - - 1

I then worked from the ground-left-front corner, putting its friends in the back centre and the top-right edge:

1 - -    - 2 -    - - -
- - -    - 1 -    - - 2
2 - -    - - -    - - 1

Because I like symmetry, I thought the best thing to do next was to fill out the diametrically opposite positions with the next colour:

1 - -    - 2 -    - - 3
3 - -    - 1 -    - - 2
2 - -    - 3 -    - - 1

Now, that is interesting. The first three colours line up in columns - a different column in each grid, and each a rotation of the one before. Let's move on to the next corner, and stick a 4 in the ground-back-right. I'll pick the top-front edge and left centre to go with it, like so:

1 - 4    - 2 -    - - 3
3 - -    4 1 -    - - 2
2 - -    - 3 -    - 4 1

... and again, match these with their opposites (although, for reasons of Emerging Symmetry, I will jump to number 7):

1 7 4    - 2 -    - - 3
3 - -    4 1 7    - - 2
2 - -    - 3 -    7 4 1

The ground-front-right corner can be 5, matched with the back-left edge and the top centre:

1 7 4    5 2 -    - - 3
3 - -    4 1 7    - 5 2
2 - 5    - 3 -    7 4 1

And, diametrically opposite, let's put 9:

1 7 4    5 2 -    9 - 3
3 9 -    4 1 7    - 5 2
2 - 5    - 3 9    7 4 1

Doing it colour-wise, I was crossing my fingers at this point that it would all work, but with numbers it's pretty obvious where the remaining cubes go - the 6s where the columns with 4 and 5 and rows with 3 and 9 meet, and the 8s where the 7/9 columns meet 2/5.

1 7 4    5 2 8    9 6 3
3 9 6    4 1 7    8 5 2
2 8 5    6 3 9    7 4 1

And there we are! The top and ground grids have each digit once, as do the left and right ones, and the front and back.

But there's more

As an added bonus, so do each of the middle slices - which means you could cut off any face and move it to the other side of the cube, as often as you liked, and it would still work. You could also swap any pair of parallel slices, as often as you liked.

In the representation I've gone for, each horizontal slice is the same as the one before it, shifted forward one and right one (wrapping around in an obvious way).

There are plenty of questions I don't have answers to, though, the main one being: is this the only solution (up to symmetry)? I'll leave that as an exercise for the interested reader.


Colin is a Weymouth maths tutor, author of several Maths For Dummies books and A-level maths guides. He started Flying Colours Maths in 2008. He lives with an espresso pot and nothing to prove.

  1. especially for the colour-blind []


3 comments on “The Problem Of The Nine-Coloured Cube

  • Barney Maunder-Taylor

    Success! – but I had to make my own (cardboard) a cube first – was unable to do it with Alison’s (admittedly ingenious) virtual cube, and certainly not by just visualising it. A breakthrough came when I saw a hexagonal ring of edge pieces. Now I can read your blog and see how the problem should have been approached! Thanks for a great puzzle!

  • Karl

    Thanks for this great explanation Colin. I wanted to set this for my students for problem solving; but after trying it myself (and after 2 hours I still hadn’t cracked it) I thought that it would be too hard for them! I was trying to avoid the number 1’s across the opposite corners and I guess that was where I was going wrong! I previously thought, “Blooming Youcubed setting the impossible………………”

    • Colin

      Thanks, Karl!

      I think it might make a good extension/challenge activity – especially if you set it up as “my friend says there’s a solution, but *I* couldn’t find it, I wonder if you brilliant problem-solvers can?” (I reckon it might be a problem where someone who doesn’t think they’re “good at maths” might find the solution before the usual suspects do.) Let me know how it goes if you try it!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Sign up for the Sum Comfort newsletter and get a free e-book of mathematical quotations.

No spam ever, obviously.

Where do you teach?

I teach in my home in Abbotsbury Road, Weymouth.

It's a 15-minute walk from Weymouth station, and it's on bus routes 3, 8 and X53. On-road parking is available nearby.

On twitter