# Painted faces on a cube

Here's another challenge I used to give to my students:

Let's begin with a bunch of little white cubes assembled into a big white cube. All the little white cubes are equal.
Then I decide to paint some of the faces of the big cube blue. Afterwards I break the big cube apart into the smaller ones.
Only $$24$$ of the smaller cubes remain completely white.

How many cubes formed the big one? How many big faces did I paint?

Usually I use this problem to show how much we can deduce with so little information.

It hinges on the following insight:

Don't break the cube apart but keep the small cubes packed together. If you paint some faces of the cube, and remove the painted layers, you have a cuboid where each dimension is at zero, one or two units shorter than the original cube.

That means that the $$24$$ unpainted cubes

form a three-dimensional cuboid with dimensions that differ by at most two. The only way to factor $$24$$ like that is as $$24=2\times3\times4$$. Therefore you started with a $$4\times4\times4$$ cube and removed three layers, two of them opposite each other.

• That is a GREAT approach! If I could I give you $10$ upvotes! :)
– Pspl
Jul 10 '20 at 8:10

In general, you can paint 6 sides of an N×N×N cube in 10 ways:

* 0 sides
* 1 side
* 2 opposite sides
* 3 adjacent sides (a corner)
* 3 sides, two of them opposite (a band)
* 4 sides except 2 opposite
* 4 sides except 2 adjacent
* 5 sides
* 6 sides

which leaves you with these numbers of unpainted sub-cubes, respectively:

* N×N×N
* N×N×(N–1)
* N×(N–1)×(N–1)
* N×N×(N–2)
* (N–1)×(N–1)×(N–1)
* N×(N–1)×(N–2)
* N×(N–2)×(N–2)
* (N–1)×(N–1)×(N–2)
* (N–1)×(N–2)×(N–2)
* (N–2)×(N–2)×(N–2)

Given a number of unpainted cubes,

one needs to find a factorisation that fits one of those expressions.

As Jaap Scherphuis shows, the value of 24 fits just one, which yields only 1 answer.

• Note that all but three of those expressions are definitely ambiguous. Jul 10 '20 at 9:11
• @JaapScherphuis Yes. That means solution needn't be unique. If one takes a cube 6×6×6 and removes one layer from all faces, or one removes one layer from three adjacent faces of a 5×5×5 cube, or one leaves a 4×4×4 cube intact, the number of unit cubes left will be the same. Jul 10 '20 at 17:25

My approach was to...

start off by bounding the possible dimensions of the big cube, and then find a valid permutation of face-painting from that subset. But after bounding the size, finding a permutation became unnecessary.

To determine...

a maximum bound: We can be certain that the inner cube of dimensions $$(N-2)$$ will remain untouched no matter how the big cube is painted, so that must hold an equal or fewer number of small cubes than how many are left untouched. $$(N-2)^3 \leq 24$$. Since $$3^3$$ is already $$27$$,

$$N<5$$ is a maximum bound.

Then to determine...

a minimum bound: If at least one face of the big cube is painted, then the largest number of untouched unit cubes possible is the total number of cubes, minus one face of cubes. $$N^3-N^2 \geq 24$$. Since $$3^3-3^2$$ is only $$18$$,

$$N>3$$ is a minimum bound.

Therefore...

$$N$$ must be greater than $$3$$ and less than $$5$$, so $$4$$ is the only possible answer. It is not necessary to determine exactly what pattern of sides were painted to be certain of the answer.

With a 4x4x4 cube, there are 56 outer cubes; 40/16 paint/blank. The most cubes you can paint with a face is 16, so you need more than 2 faces. meanwhile 4 faces painted leaves only 8 or 10 cubes blank. So 3 faces must be painted. Finding the permutation is still unnecessary for the total answer. But to be specific, 16 for one face, +12 for each single-adjacent space. So 3 faces painted in a U-shape on a 4x4x4 cube is the full description of the cube.

• I too started with finding the bounds. +1. But the second half of the question is "How many big faces did I paint?" You do need the pattern (subject to rotation&reflection) to determine that. Jul 12 '20 at 19:50
• True - I could have elaborated on the final step, but everyone else had already given accurate answers - finding the number of painted sides is trivial once the size of the cube is known. I was just trying to emphasize that this piece of information could be gathered through simple, broad deduction without having to guess and check through permutations. Jul 16 '20 at 19:09

You can represent the unpainted volume like this:

$$(n-x_1-x_2)(n-y_1-y_2)(n-z_1-z_2) = 24$$
where $$x_1,x_2,y_1,...$$ are either $$0$$ or $$1$$, representing whether the face was painted.

This means all we need to do is

Factorise $$24$$ into 3 factors such that any two factors are at most $$2$$ apart

We know that

The prime factorisation of $$24$$ is $$2\cdot 2\cdot 2\cdot 3$$

Which means you have the following combinations:

• $$2\cdot 3\cdot 4$$
• $$2\cdot 2\cdot 6$$

Only one of which works, meaning that:

$$(n-x_1-x_2)(n-y_1-y_2)(n-z_1-z_2)=2\cdot 3\cdot 4\\\therefore(n-1-1)(n-1-0)(n-0-0)=2\cdot 3\cdot 4$$
Since $$x_1+x_2+y_1+y_2+z_1+z_2$$ sides are painted, we know that $$3$$ sides were painted.
Since $$(n-0-0)=4$$, we know that the original cube side length must have been $$4$$.

I haven't looked at the other answers so I hope I haven't done anything too similar to anyone else :)

• Having looked at the top answer, I realise this is essentially just a longer version of that, but I think it adds a little bit more explanation so I'll keep it up :) Jul 11 '20 at 16:26

Here is my way of looking at it:

I started off by representing situations with my favorite variable ‘x’ (I’m more of a math kind of person). For example, let x be the length of a side of the larger cube, so $$x^3-x^2=24$$ represents a situation where 1 face is painted blue, and those blue squares are removed ($$x^3$$ is the whole cube volume, so subtracting $$x^2$$ gives you the leftover volume after removing one face).

Then we move on to 2 blue faces...

$$x^3-2x^2=24$$ represents painting 2 blue faces that are opposite each other so the faces aren’t touching. And $$x^3-2x^2+x=24$$ represents 2 blue faces touching each other. The ‘plus x’ accounts for the fact that counting $$x^2$$ twice when the sides are touching means you are counting one edge two times; $$2x^2$$ tells you how many blue faces there are for the small cubes, so adding x will tell you how many cubes have any blue.

And so on... keeping in mind how many touching faces there are, we find that:

$$x^3-3x^2+2x=24$$ is the only equation out of all possible numbers of blue faces where a solution for x is a whole number ($$x=4$$). Remember that x represents the length of a side of the cube, so if the above equation is the only one with a whole number x, it’s the only one with a whole number side length and the only solution that works. The equation $$x^3-3x+2x=24$$ represents 3 blue sides, with 2 over laps (see coefficients). So since $$x=4$$, this means the whole cube has volume $$4^3$$ since x is AGAIN, the length of a side of the big cube.

Therefore...

You used 64 smaller cubes and painted 3 faces so that there are 2 edges where the faces touch (as in 2 of the faces are opposite each other).