The surface integral $\int_S z^2 \, dS$ over the cube $S$ 
Evaluate the integral
  $$\int_S z^2 \, dS ,$$
  where $S$ is the surface of the cube $\{-1 < x < 1, -1 < y< 1, -1< z< 1\}$.

So I gather that it has six sides. So what I did was evaluate the surface integral for one side and got $8/3$. So shouldn't the answer be $48/3$?
The actual answer is $40/3$.
 A: We have $6$ surface integrals, for each of the $6$ faces of the cube $S$.
Let
$S_1$ and $S_2$ be the top faces of the cube $z=1$ and $z=-1$
Let $S_3$ and $S_4$ be the side faces of the cube parallel to the $y$-axis
And let $S_5$ and $S_6$ be the other two faces, which are parallel to the $x$-axis 
For $S_1$ the surface integral is
$$\iint_{S_1} z^2 \mathrm d S = \iint_{S_1}\mathrm dS = \text{area of S}_1=4$$ and similarly, 
$$\iint_{S_2} z^2\mathrm d S = 4$$
The equation of the surfaces $S_3$ and $S_4$ are $x=-1$ and $x=1$ respectively.
The equation of the surfaces $S_5$ and $S_6$ are $y=-1$ and $y=1$ respectively.
So for $S_3$ and $S_4$ we integrate over the surface with respect to $y$ and $z$ as $x$ is constant. 
So $$\iint_{S_3} z^2 \mathrm d S = \iint_{S_4} z^2 \mathrm d S = \int_{y=-1}^{y=1}\int_{z=-1}^{z=1}z^2 \mathrm d z \mathrm d y = \frac{4}{3}$$
Now, for surfaces $S_5$ and $S_6$, $y$ is constant, so we integrate with respect to $x$ and $z$. 
So
$$\iint_{S_5} z^2 \mathrm d S = \iint_{S_6} z^2 \mathrm d S = \int_{x=-1}^{x=1}\int_{z=-1}^{z=1}z^2 \mathrm d z \mathrm d x = \frac{4}{3}$$
Now,
$$\iint_S z^2 \mathrm d S = \iint_{S_1} z^2 \mathrm d S + \iint_{S_2} z^2 \mathrm d S + \iint_{S_3} z^2 \mathrm d S + \iint_{S_4} z^2 \mathrm d S + \iint_{S_5} z^2 \mathrm d S + \iint_{S_6} z^2 \mathrm d S $$
So
$$\iint_S z^2 \mathrm d S = 4 + 4 + 4\cdot \frac{4}{3} = \frac{40}{3}$$
A: Like Patrick Jankowski's answer points out, the value of the integral over the top and bottom faces need not agree with the integrals over the side faces.
Here's an alternative method that requires some thought to set things up but lets the Divergence Theorem do the heavy lifting for us and in particular lets us avoid decomposing our integral into a sum of integrals.
Hint Write the integral $$\iint_S z^2 \,dS$$ that we want to evaluate as $$\iint_S {\bf F} \cdot {\bf n} \,dS$$
for some (continuously differentiable) vector field $\bf F$, where $\bf n$ is the unit normal to the cube. (Strictly, $\bf n$ is only defined on the interiors of the faces of the cube $C$, but this misses only the union of the edges of the $C$, which have measure zero and so don't contribute to the original integral anyway.) Then, applying the Divergence Theorem will give
$$\iint_S z^2 \,dS = \iint_S {\bf F} \cdot {\bf n} \,dS = \iiint_C \operatorname{div} {\bf F} \,dV.$$

 Some thought verifies that, for example, ${\bf F} = z^2 \langle x, y, z \rangle$ satisfies ${\bf F} \cdot {\bf n} = z^2$, and computing gives $\operatorname{div} {\bf F} = 5 z^2$. So, $$\iint_S z^2 \,dS = \iiint_C \operatorname{div} {\bf F} \,dV = \iiint_C 5 z^2 \,dV = 5 \int_{-1}^1 dx \int_{-1}^1 dy \int_{-1}^1 z^2 \,dz = \color{#df0000}{\boxed{\frac{40}{3}}} .$$

