On this page
A large cube is painted on every face, then sliced into equal small cubes. How many small cubes have paint on three faces, two, one or none? The UK maths site NRICH sets this as Painted Cube for ages 14 to 16.
How many small cubes have 2 faces painted?
A cube has 8 vertices, 12 edges and 6 square faces, and three squares meet at each vertex (Wikipedia: Cube).
A small cube gets one painted face for every outside surface it touches. That gives four kinds of position:
Corners (3 faces painted): a corner cube touches three outer faces. There are always 8 of them, whatever the size.
Edges, not corners (2 faces painted): each edge has n small cubes, two of which are corners, so 12(n − 2) in total.
Face centres (1 face painted): each face is an n × n square; remove its border and (n − 2)² cubes are left, so 6(n − 2)² in total.
Hidden core (0 faces painted): strip one layer off every side and an (n − 2) × (n − 2) × (n − 2) block is left, so (n − 2)³.
So the number of small cubes with exactly two faces painted is 12(n − 2).
Why does every formula use n − 2?
Every edge, face and the core loses one layer at each end, and two ends means subtracting 2. Forgetting this is a common slip: 12n counts each corner three times, and 6n² counts every edge cube twice.
To check the four formulas are complete, write a = n − 2. Then 8 + 12a + 6a² + a³ is exactly the expansion of (a + 2)³, which is n³, so every small cube is counted once.
What are the counts for n = 3, 4, 5 and 10?
Counts in the order 3, 2, 1, 0 painted faces. NRICH's Painted Faces asks about the 3 × 3 × 3 case, with 4 × 4 × 4 as an extension:
3 × 3 × 3 (27 cubes): 8, 12, 6, 1
4 × 4 × 4 (64 cubes): 8, 24, 24, 8
5 × 5 × 5 (125 cubes): 8, 36, 54, 27
10 × 10 × 10 (1000 cubes): 8, 96, 384, 512
Two edge cases catch people out. For n = 2 all 8 small cubes are corners, and the formulas correctly give 0 for the rest. For n = 1 the single cube has all 6 faces painted, and the formulas do not apply.
How do you solve it backwards?
Many versions give one count and ask for another: use it to find n − 2, then substitute.
96 small cubes have exactly 2 faces painted. How many have none? 12(n − 2) = 96, so n − 2 = 8 and the unpainted count is 8³ = 512.
125 small cubes have no paint. How many have exactly 1 face painted? (n − 2)³ = 125, so n − 2 = 5 and the answer is 6 × 5² = 150.
How many have at least one face painted when n = 10? Count the opposite: 10³ − 8³ = 1000 − 512 = 488.
When one of these goes wrong, the slip is usually in the method (n instead of n − 2), not the arithmetic. The Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer, so you can see which step went wrong.
What changes for a cuboid or a partly painted cube?
The same idea works for an a × b × c cuboid with every side at least 2. Each direction loses 2, so:
3 faces: 8
2 faces: 4[(a − 2) + (b − 2) + (c − 2)]
1 face: 2[(a − 2)(b − 2) + (b − 2)(c − 2) + (c − 2)(a − 2)]
0 faces: (a − 2)(b − 2)(c − 2)
For a 3 × 4 × 5 cuboid that gives 8, 24, 22 and 6, which add up to 60 = 3 × 4 × 5. For how many small cubes fit inside a box in the first place, see our guide to counting small cubes in a cuboid.
If only some faces are painted, only those faces strip a layer. Paint the top and bottom of an n-cube and the unpainted block is n × n × (n − 2). NRICH's Partly Painted Cube turns this around: a cube leaves 45 unpainted small cubes, and you must find its size and which faces were painted. A hint: 45 = 5 × 3 × 3.
Read the question carefully: dipped in paint means all six faces, but painted on the top and sides leaves the bottom bare, which changes every count.
To practise, predict the four counts for n = 6 and check they add up to 216. Classifying positions before counting is a habit olympiad problems reward too; our 4-week plan for starting combinatorics builds it step by step, and why every cube is a sum of consecutive odd numbers is another cube pattern you can prove with pictures.



