Given a painted cube composed of smaller cubes, what is the probability of an unpainted cube given you see 5 unpainted faces? For a cube composed of $3 \times 3 \times 3$ smaller cubes has the outside painted red. If a small cube is placed on the table and you see all $5$ visible faces are unpainted, what is the probability the unseen face is also unpainted?  
What is the general case for a $n \times n \times n$ cube?
I know it should use Bayes Theorem $P(6th\;Unpainted | 5\;Unpainted\; Face) = \frac{P(5\;Unpainted\; Face | 6th\;Unpainted)\cdot P(6th\;Unpainted)}{P(5\;Unpainted\; Face)}$ but not sure what probabilities to use.
 A: Cubes with $0$ painted sides $= C_0 = (n-2)^3$
Cubes with $1$ painted side $= C_1= 6(n-2)^2$
Instances where $5$ unpainted sides are visible $= C_0 + \frac{1}{6}C_1$
The probability that the cube has $0$ painted sides is therefore $$P=\frac{C_0}{C_0 + \frac{1}{6}C_1}$$
or
$$P=\frac{(n-2)^3}{(n-2)^3 + (n-2)^2}$$
or $$P=\frac{n-2}{n-1}$$
A: Note, that every $n\geq 2$ the cube $n\times n \times n$ have exactly: 


*

*$8$ parts with 3 red sides (the corners)

*$12(n-2)$ parts with 2 red sides (edges without corners).

*$6(n-2)^2$ parts with one red side (sides without edges and corners)

*$(n-2)^3$ clean parts (cube without sides)


Denote:


*

*$P_c=P(\text{picking clean part}) = \frac{(n-2)^3}{n^3}$

*$P_o=P(\text{picking part with one red side})=\frac{6(n-2)^2}{n^3}$

*$P_{t0} = P(\text{tossing dice with no red side to have 5 visible sides clean})=1$

*$P_{t1} = P(\text{tossing dice with one red side to have 5 visible sides clean})=\frac{1}{6}$

*$P_5 = P(\text{tossed dice have 5 visible sides clean})$

*$P_{c|5}=P(\text{tossed dice is clean|tossed dice have 5 visible sides clean})$

*$P_{5|c}=P(\text{tossed dice have 5 visible sides clean|tossed dice is clean})$


Of course $P_{5|c} =1$
Probability of tossing 5 visible clean sides is:
$$P_5=P_cP_{t0}+P_oP_{t1}=\frac{(n-2)^3+(n-2)^2}{n^3}$$
Now the probability of having clean dice under the condition that 5 visible sides are clean is:
$$P_{c|5} = \frac{P_{5|c}P_c}{P_5} = \frac{\frac{(n-2)^3}{n^3}}{\frac{(n-2)^3+(n-2)^2}{n^3}} = \frac{(n-2)^3}{(n-2)^3+(n-2)^2}=\frac{(n-2)^2(n-2)}{(n-2)^2(n-1)}=\frac{n-2}{n-1}$$
