How to Solve a Polycube Puzzle: Volume, Colour and Layers
This article was written with AI and may contain mistakes. Found one? Tell us.
To solve a polycube puzzle, first check that the cubes in all the pieces add up to the cubes in the box, then colour the box like a three-dimensional checkerboard to see which pieces must balance each other. After that, place the most awkward piece first, fill the box one layer at a time and back up a single piece whenever a cell becomes impossible to reach.
This guide explains the pieces, the four checks that do most of the work, a full worked example in a small box and a slightly longer box to try yourself, with its answer.
What is a polycube puzzle?
A polycube is a solid made of equal cubes. A paper published in 2003 defines a polycube in any dimension as a finite union of unit cubes whose corners sit on the points of a whole-number grid, and it notes that such a shape does not even need to be connected [1]. The same paper treats the flat shapes made of squares as the two-dimensional case of this idea [1].
In a puzzle, each piece is a set of cubes glued face to face, so every piece is one connected solid. Your task is to fit a given set of pieces into a box, usually a cube or a brick shape, with no gaps and no overlaps.
Pieces may be turned in any direction. Most pieces are their own mirror image, but a piece that comes in a left-handed and a right-handed form can never be turned into the other form.
That last point matters more than it seems, because usually only one of the two forms is in your set.
Which small pieces should you know?
Most puzzles are built from pieces of three, four or five cubes. Knowing the small ones by sight saves a lot of turning in your head. The table lists every piece of three and four cubes, with the short names used in this guide. We counted them by computer: there are two pieces of three cubes and eight pieces of four cubes, or seven if the two mirror-image twisted pieces are treated as one.
| Name | Cubes | Shape | Flat? | Colour split |
|---|---|---|---|---|
| Short bar | 3 | Three cubes in a straight line | Yes | 2 and 1 |
| Small corner | 3 | Three cubes bent at a right angle | Yes | 2 and 1 |
| Long bar (I) | 4 | Four cubes in a straight line | Yes | 2 and 2 |
| Square (O) | 4 | A two by two square | Yes | 2 and 2 |
| Hook (L) | 4 | Three in a line, one more at an end, turned sideways | Yes | 2 and 2 |
| Tee (T) | 4 | Three in a line, one more beside the middle cube | Yes | 3 and 1 |
| Step (S) | 4 | Two pairs, side by side and shifted by one | Yes | 2 and 2 |
| Twisted piece (R) | 4 | A small corner of three, plus one cube rising out of its plane | No | 2 and 2 |
| Mirror twist | 4 | The mirror image of the twisted piece | No | 2 and 2 |
| Branch (B) | 4 | One cube with three neighbours in three different directions | No | 3 and 1 |
The colour split column is explained below. For now, notice that only the tee and the branch are lopsided among the pieces of four.
Why should you count the cubes first?
Counting cubes is the one check you can finish before touching a piece. Count the cubes in every piece, add them up and compare the total with the size of the box, which is length times depth times height.
If the totals differ, the puzzle has no answer, or it is a different kind of puzzle where some space is meant to stay empty. If they match, every single cell of the box must be filled, and you can use that fact all the way through. A cell that no remaining piece can reach means you have already gone wrong.
What is the three-dimensional checkerboard count?
Imagine painting the cells of the box in two colours, dark and light, so that any two cells sharing a face have different colours. It is the checkerboard pattern, carried up through every layer. A box with an even number of cells has as many dark cells as light ones. In a three by three by three cube, one colour wins by a single cell, 14 to 13 in our count.
Now look at each piece the same way. However you place it, a piece covers a fixed number of each colour. The long bar always covers two of each. The tee always covers three of one colour and one of the other, and so does the branch.
This gives a quick test. In our worked example below, the box has six dark and six light cells. Three tee pieces have the right volume, 12 cubes, but each one tips the count by two. Three lopsided pieces can never add up to a perfect balance, so three tees can never fill that box. Our exhaustive search agrees: no arrangement exists.
The colour count also tells you something useful when a solution does exist. If a set holds exactly two lopsided pieces and the box is balanced, those two pieces must lean towards opposite colours.
Why do the corners and awkward pieces go first?
A box has eight corner cells, and each one has only three neighbours. That makes corners the hardest cells to fill. Ask which pieces can even reach a corner without poking out of the box, and you often find only one or two.
The same idea works for pieces. A flat piece three cubes long fits in fewer places than a compact one. A piece with a long reach, such as the long bar, is easy to place early and hard to place late, when the gaps have become small. Put the pickiest pieces in first and leave the flexible ones for the end.
A paper published online on 11 August 2023 studied packing solid cubes of many sizes into one larger cube with every edge kept parallel to its edges, and its method sorts the cubes from largest to smallest and fills the larger cube in successive layers [2].
A puzzle with a fixed set of pieces is a different problem, but the same largest-first order makes good advice. In our own solving, a big piece left until late is the one most likely to get stuck.
Why does thinking in layers help?
Turning a whole solid in your head is hard. Looking at one flat slice at a time is much easier. Split the box into horizontal layers and draw each layer as a small grid. Every piece then appears as a few cells in one or more neighbouring layers.
Layers also show you what a piece can do. A flat piece, such as the tee, lies entirely inside one slice of the box, while a twisted piece or a branch always crosses from one slice into the next. When a layer has an isolated cell, the piece that fills it must come from the layer above or below.
The 2023 paper also looks at when big cubes block each other [2]. It recalls that two cubes whose edges are each longer than half the edge of the larger cube cannot both fit inside it with their edges parallel to its edges, since together they are too long in every direction [2].
It then proves that cubes avoiding this kind of size conflict, which the authors call non-blocking, always fit into one larger cube, with every edge parallel to it, when their total volume is at most one third of that cube [2].
That bound cannot be raised for this kind of packing, because nine cubes with edges longer than a third of the larger cube's edge cannot all be fitted inside it with their edges parallel to its edges [2].
What is the step-by-step method?
- Check the volume. Add the cubes in all pieces and compare with the box. Stop if they differ.
- Count the colours. Colour the box like a checkerboard in every layer and note each piece's split. Decide which lopsided pieces must balance each other.
- List the awkward pieces. Mark flat pieces, long pieces and pieces with a fixed handedness. These go first.
- Use the symmetry of the box. If the box looks the same after a turn, the first piece has fewer truly different positions than it seems. Try each one only once.
- Fill the hardest cells. After each placement, look for cells with only one free neighbour. The piece that fills such a cell has very few choices.
- Back up one step at a time. When a cell can no longer be filled, undo the last piece and try its next position, rather than clearing the whole box.
- Check the finished box. Count each piece's cubes in your layer drawings and make sure every cell holds exactly one piece.
How does the method solve a three by two by two box?
Here is an original puzzle. Fill a box three cubes long, two deep and two tall with three pieces: the tee, the twisted piece and the branch. The answer tables at the end of this section also fix which hand the twisted piece has. Our exhaustive search found exactly one solution, counting any turned copy of the whole box as the same solution.
Step 1: volume. The pieces hold four cubes each, so 12 in total, and the box holds three times two times two, also 12. Every cell will be filled.
Step 2: colours. The box has six dark and six light cells. The twisted piece covers two of each, while the tee and the branch each cover three of one colour. So the tee and the branch must lean towards opposite colours.
Step 3: the tee. The tee is flat and three cubes long, so it must lie inside one of the four three by two slices of the box. Every one of those positions looks the same after turning the box, so place it in the bottom layer, with its bar along the back row and its nub in the middle of the front row.
Step 4: what is left. The bottom layer now has two empty cells, the two front corners, and they do not touch. Each has only one free neighbour, the cell directly above it. So one piece must climb up from each corner, and the twisted piece and the branch get one corner each.
Step 5: the branch. The branch cannot have its centre on a bottom corner, since that cube would need three free neighbours. Its centre must be the cube directly above one corner, with arms going down, along the front and towards the back.
Try the left corner first. The four cells left over make the mirror image of our twisted piece, which is the wrong hand, so that fails. Put the branch on the right instead, and the leftover cells form exactly the twisted piece.
Step 6: check. If the back left cell of the bottom layer is dark, the tee covers three dark cells and the branch covers three light ones, as step 2 demanded. Here is the answer, layer by layer, seen from the front.
Bottom layer
| Column 1 | Column 2 | Column 3 | |
|---|---|---|---|
| Back row | T | T | T |
| Front row | R | T | B |
Top layer
| Column 1 | Column 2 | Column 3 | |
|---|---|---|---|
| Back row | R | R | B |
| Front row | R | B | B |
The twisted piece rises from the bottom front left corner, then bends back and turns right in the top layer. That exact shape, not its mirror image, is the one used in the practice puzzle too.
How does a computer check a packing puzzle?
A computer does not need clever ideas. It lists every position of every piece that fits inside the box, then fills the box cell by cell, always choosing the empty cell with the fewest pieces that can still cover it. When no piece fits, it undoes the last choice. That is step 5 and step 6 of the method above, run without getting tired.
We used exactly this kind of exhaustive search to check every board in this guide, including the claim that each puzzle has only one solution once turned copies are treated as the same. It is a good way to design puzzles too: try a set of pieces, count the solutions and keep the sets with one.
What do mathematicians know about filling space with cubes?
Packing puzzles touch a deep corner of geometry. A paper published on 6 June 2012 studied tilings that fill all of space, in any number of dimensions, with equal unit cubes [3]. It recalls an old question of whether every such tiling must contain a column, a full straight line of cubes, and that tilings without one have been found in 8 and in 10 dimensions [3].
The main result of that paper is a counting rule for any tiling of all of space by unit cubes [3].
Choose one cube of the tiling and keep only the cubes whose positions differ from it by whole numbers of units in every direction. Then, for any whole number m and any cube-shaped region of side m with faces parallel to the tiling, the number of kept cubes whose corner point lies in that region is a multiple of m [3].
That is not a puzzle method, but it shares the idea behind the colour check. In both cases, simply counting cubes inside a box rules out arrangements that no amount of turning could ever make work.
Can you solve this practice puzzle?
Now try a longer box. Fill a box five cubes long, two deep and two tall with five pieces: the long bar, the square, the tee, the twisted piece from the worked example and the branch. Our exhaustive search found exactly one solution, again counting turned copies of the whole box as the same.
Some hints, if you want them:
- The volume is 20 cubes for both the box and the pieces.
- The long bar cannot lie across the box, so it runs along the length. Up to turning the box, it has only one position, leaving a single empty cell at one end of its row.
- The colours balance at ten each, so the tee and the branch must lean towards opposite colours once more.
What is the answer to the practice puzzle?
Here is the only solution, layer by layer, seen from the front. I is the long bar, O the square, T the tee, R the twisted piece and B the branch.
Bottom layer
| Column 1 | Column 2 | Column 3 | Column 4 | Column 5 | |
|---|---|---|---|---|---|
| Back row | R | O | O | B | B |
| Front row | R | O | O | T | B |
Top layer
| Column 1 | Column 2 | Column 3 | Column 4 | Column 5 | |
|---|---|---|---|---|---|
| Back row | I | I | I | I | B |
| Front row | R | R | T | T | T |
The long bar lies along the top back row. The square lies flat in the bottom layer, in columns 2 and 3, and the tee lies flat in the corner made by the front wall and the right end. The branch sits in the back right corner with its centre in the bottom back row, column 5, and the twisted piece fills the left end.
Where can you practise seeing in three dimensions?
The same habits, counting cubes, slicing a solid into layers and keeping track of hidden cells, help with every spatial riddle. Try counting every cube in a stack where some of them are hidden from view.
References
- Bodini, O. (2003, January 1). Tiling a Rectangle with Polyominoes. Discrete Mathematics and Theoretical Computer Science, AB(DMCS), 81-88. DOI 10.46298/dmtcs.2313
- Januszewski, J., & Zielonka, Ł. (2023, August 11). Packing of Non-Blocking Cubes into the Unit Cube. Beiträge zur Algebra und Geometrie / Contributions to Algebra and Geometry, 65(3), 635-643. DOI 10.1007/s13366-023-00710-1
- Kisielewicz, A. P., & Przeslawski, K. (2012, June 6). The Coin Exchange Problem and the Structure of Cube Tilings. The Electronic Journal of Combinatorics, 19(2), P26. DOI 10.37236/2251