Tuesday 21 April 2015

Painted Cubes Solution



The 3 x 3 x 3 cube has:
- 1 cube right in the middle with zero sides painted
- 6 cubes with one side painted (1 in the centre of each of the six faces)
- 12 cubes with two sides painted (1 in the centre of each edge of the large cube)
-8 cubes with three sides painted (1 in each of the eight corners of the larger cube)


In general, for an n x n x n cube, think about how to count all the cubes with no sides painted.  Imagine removing the entire outer layer of small cubes.  You’ll be left with a cube in the centre, but each of its dimensions will be shrunk by 2 because a layer of cubes has been removed from both sides.  Now it is an n-2 by n-2 by n-2 cube so it has (n-2)3 little cubes with no sides painted.  For the cubes with one side painted, these are on the interior of each face.  By similar reasoning as above, this is an n-2 by n-s square, so there are (n-2)2 of these for each of the six faces, so 6(n-2)2 have one side painted.  For the cubes with two sides painted, these are along each of the twelve edges.  There are n-2 of these along each edge so there are a total of 12(n-2) cubes with two sides painted.  Finally, no matter how large the cube is, the only cubes with 3 sides painted are the corner cubes therefore there are always 8 cubes with three sides painted.