# Calculating the internal volume of a cube with wall thickness

I am trying to find a formal for calculating the internal volume of a cube.

for instance:

[][][][][]
[]{}{}{}[]
[]{}{}{}[]
[]{}{}{}[]
[][][][][]


with a height of $5m$, while each [] and {} represents $1m^3$ block.

with this example the internal cube ({}) is $27m^3$ (3*3*3).

I'm sure that's not a very good explanation, let me try another way. Imagine a cube at 5*5*5. Each block is $1m^3$. There must be a floor, ceiling, and walls. Given this requirement, this leaves the 3*3*3 inner cube.

Another example is a 3*3*3 leaving an interior of 1*1*1.

The question then is what's a formula that could calculate the inner volume given A by B by C?

This may not be a cube either could be a rectangle.

-
What about (a-2)(b-2)(c-2)? – rbm Apr 24 '13 at 13:21
A block $A \times B \times C$ is a parallelepiped or brick, but not a cube unless $A=B=C$ – Ross Millikan Apr 24 '13 at 13:25
@RossMillikan of course, I had given a cube as two examples and had realized the possibility of other shapes. – Eonasdan Apr 24 '13 at 13:29
I appreciate the amount of effort you put into explaining your problem clearly. Not everyone does this. Thanks! – MJD Apr 24 '13 at 14:09
@MJD You're welcome. I spend a lot of time on SO so I try my best to write my own questions the way I expect others to write theirs. – Eonasdan Apr 24 '13 at 14:41

In each dimension, the walls will subtract 1 from each side (top-bottom, left-right, etc) so the inner volume of $A\times B\times C$ is $(A-2) \times (B-2) \times (C-2)$
I thought of that but it seemed to simple. Given 6*7*4 the inner dimensions should be $40m^3$? Right? Guess this question was more of a sanity check :) – Eonasdan Apr 24 '13 at 13:23