Question on evaluating the surface integral over a cube

Here's the question:

Evaluate $\iint_{S} \boldsymbol{F} \cdot \boldsymbol{\hat{n}}$ if $\boldsymbol{F} = (x+y) \boldsymbol{\hat{i}} + x \boldsymbol{\hat{j}} +z \boldsymbol{\hat{k}}$ and $S$ is the surface of the cube bounded by the planes $x=0$,$x=1$,$y=0$, $y=1$, $z=0$ and $z=1$.

Here's my attempt: Suppose the faces whose equations are $x=0$,$x=1$,$y=0$, $y=1$, $z=0$ and $z=1$ are respectively named $S_1$, $S_2$ and so on respectively and let $\boldsymbol{\hat{n}}$ denote the unit vector normal to them.

Now on $S_1$, $\boldsymbol{F} = y \boldsymbol{\hat{j}} +z \boldsymbol{\hat{k}}$, $\boldsymbol{\hat{n}}=\boldsymbol{\hat{i}}$. Therefore $\iint_{S_1} \boldsymbol{F} \cdot \boldsymbol{\hat{n}} = \int_{0}^{1} \int_{0}^{1} y \mathrm{d}y \mathrm{d}z = \frac{1}{2}$.

Similarly we have $\iint_{S_2} \boldsymbol{F} \cdot \boldsymbol{\hat{n}} = \frac{3}{2}$, $\iint_{S_3} \boldsymbol{F} \cdot \boldsymbol{\hat{n}} = \frac{1}{2}$, $\iint_{S_4} \boldsymbol{F} \cdot \boldsymbol{\hat{n}} = \frac{1}{2}$, $\iint_{S_5} \boldsymbol{F} \cdot \boldsymbol{\hat{n}} = 0$ and $\iint_{S_6} \boldsymbol{F} \cdot \boldsymbol{\hat{n}} = 1$.

Hence overall we have $\iint_{S} \boldsymbol{F} \cdot \boldsymbol{\hat{n}} = 4$. But the answer on the textbook seems to be $2$. I checked everything up and there doesn't seem to be any error on my part but I was wondering how the answer doesn't match up.

• Check the signs on your normal vectors. How do the normal vectors for $S_1$ and $S_2$ differ? – Michael Burr Jul 24 '18 at 10:14

In your case, the outward pointing normal vector for $S_1$ is $\langle -1,0,0\rangle$, which changes the sign of your answer. The outward pointing normal vector for $S_2$ remains $\langle 1,0,0\rangle$, so that answer doesn't change. There are two more vectors which need to swap signs, and after that, you'll get $$\left(-\frac{1}{2}\right)+\frac{3}{2}+\left(-\frac{1}{2}\right)+\frac{1}{2}+(-0)+1=2.$$
$$div\boldsymbol{F} = 2\implies \iint_{S} \boldsymbol{F} \cdot \boldsymbol{\hat{n}}\, dS=\iiint_{V} div\boldsymbol{F} \,dV=2 \iiint_{V} \,dV=2$$