# Editorial - Kevin and the Cube

# PROBLEM LINK:

* Author:* Bhuvnesh Solanki

*Jayesh Nirve*

**Tester:***Bhuvnesh Solanki*

**Editorialist:**# DIFFICULTY:

SIMPLE

# PREREQUISITES:

# PROBLEM:

An N x N x N (N>2) cube is dipped into paint so its entire surface is coated. It is then then disassembled into N^{3} cubelets (of size 1 x 1 x 1). One is cubelet is selected such that at least 5 of its faces are not painted. This cubelet is **rolled** on a table. From the five sides you can observe of the cubelet, no side is painted. What is the probability that the bottom side (that you cannot observe) is painted?

# EXPLANATION:

In the question the cubelet that is rolled on the table has its 5 visible faces not painted. This is only possible if the cubelet has 1 face painted or no faces painted. If an NxNxN cube (N>2) were to be completely dipped into paint and disassembled as described in the question, the number of cubelets with 1 face painted would be **6(N-2) ^{2}** and the number of cubelets with no faces painted would be

**(N-2)**.

^{3}The cubelet is rolled like a die on the table. If the cubelet had 1 face painted, there would only be a

**1/6**chance that the painted face would be on the bottom. If the painted face were in any other position except bottom, then it would not satisfy the condition that we are given. Remember we are told that from the five faces that are visible, none of them are painted. The final face on the bottom may or may not be painted. The cubelet with no faces painted is unaffected by the roll. So total number of outcomes that satisfy our condition will be :

**(N-2)**.We need to find out the probability that the cubelet has its bottom face painted, given that the other visible 5 faces are not painted. So the number of favourable outcomes will be :

^{2}+ (N-2)^{3}**(N-2)**.

^{2}The probability that we get is :

**(N-2)**. Simplify this to get

^{2}/((N-2)^{2}+ (N-2)^{3})**1/(N-1)**, which is the answer to the question.

Consider the case of N=3. It may seem that the probability for this is 6/7 or 1/7, but in truth it is 1/2. Let us see how.

Consider the following events:

A = The bottom face of the rolled cubelet is painted

B = The 5 visible faces of the rolled cubelet are not painted

We have already been told that the 5 visible faces of the cubelet that we rolled are not painted, meaning that it is a precondition. From this we understand that at least 5 faces are not painted. So we will have have to calculate P(A|B).

**Bayes’ theorem** for a joint probability distribution:

**P(A|B) = P(AB) / P(B)**

( Note: P(AB) is P(A intersection B) )

For N=3 , cubelets with exactly 1 face painted are 6 and there is only 1 cubelet with no face painted. Total number of cubelets are 27.

There is a 6/27 chance that a cubelet with exactly 1 face painted is picked. So the probability that a cubelet with 1 face painted is picked **and** it lands with its painted face on the bottom (implying that 5 visible faces are not painted) is (6/27) x (1/6) = 1/27 .

Now if a cubelet with 0 faces painted is rolled, there is a 100% chance that it will have its 5 visible faces not painted. There is a (1/27) chance that this cubelet is picked. So the probability that a cubelet with 0 faces painted is picked **and** it lands with 5 visible faces not painted is (1/27) x 1 = 1/7.

We can see from above that P(AB) = 1/27 and P(B) = (1/27) + (1/27) = 2/27. Putting this in the equation of Bayes’ theorem gives us:

P(A|B) = (1/27) / (2/27) = 1/2 which is the answer for N=3.