2
$\begingroup$

I have a painted cube, which is cut into $n^3$ smaller cubes. I now want to find the number of cubes which have $1$,$2$,$3$ sides painted. I know the long way round of taking each cube and putting them into different categories... but is there a short way or formula to do it?

$\endgroup$
3
$\begingroup$

$1$ face painted - You have to consider all the faces. There are $6$ faces, each with $(n-2)^2$ cubes with $1$ face painted . That gives you the formula $$6*(n-2)^2$$

$2$ faces painted - You have to take the edges. There are $12$ edges, each edge having $n-2$ cubes with $2$ faces painted . That gives you the formula $$12*(n-2)$$

$3$ faces painted - You have to take the corners alone. That gives you the formula $$8$$

Extra - $0$ faces painted - You have to consider the interior alone which gives $$(n-2)^3$$

| cite | improve this answer | |
$\endgroup$
  • 2
    $\begingroup$ I think that you want $8$ corners. ;-) $\endgroup$ – Sammy Black Feb 23 '16 at 7:20
  • 2
    $\begingroup$ @SammyBlack Thank you for that. Edited. $\endgroup$ – Win Vineeth Feb 23 '16 at 7:20
  • $\begingroup$ saying side is not corrrect it is face which is painted $\endgroup$ – Bhaskara-III Feb 23 '16 at 13:17
  • $\begingroup$ @Bhaskara-III The question asked for side, hence, I used side. $\endgroup$ – Win Vineeth Feb 23 '16 at 13:20
  • $\begingroup$ oops you should have correctly mentioned that it should be a painted face not a painted side in your answer because it's very confusing term $\endgroup$ – Bhaskara-III Feb 23 '16 at 13:22
2
$\begingroup$

This is an addendum to Win Vineeth's excellent answer: the particular counts fall out of the algebraic expansion (using the Binomial Theorem) of $n^3$, where we write $n = (n-2) + 2$: $$ \bigl( (n-2) + 2 \bigr)^3 = (n-2)^3 + 6(n-2)^2 + 12(n-2) + 8 $$

This approach generalizes by letting $t$ be the "thickness" of the boundary (the part that gets painted). The original question uses $t=1$. The expansion now looks like: $$ \bigl( (n-2t) + 2t \bigr)^3 = (n-2t)^3 + 6(n-2t)^2t + 12(n-2t)t^2 + 8t^3 $$ Now, the power of $t$ serves as a placeholder for the number of sides that got painted. For example, if you want to know how many subcubes got painted on $2$ sides, then look at the coefficient of $t^2$, namely $12(n-2t)$, which is $12(n-2)$ once you set $t=1$. This is an example of a generating function, where a sequence is encoded as the list of coefficients of a polynomial (or often infinite series).

This approach also has the advantage of counting the number of boundary subhypercubes of a hypercube of any dimension: just expand $n^d$, where $d$ is the dimension.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy