Why doesn't Gauss divergence work for this surface? I need to evaluate the surface integral 
$\displaystyle\int_S{F}.nds$ where $F = z\hat{i} +x\hat{j} - 3y^2z\hat{k}$ and $S$ is the surface of the 
cylinder $x^2+ y^2 = a^2$ along with the bases included in the first octant between $z =0$ and $z =b$.
Now this question is solved in my book by taking three different surfaces 
$S_1$ the bottom part of the cylinder $z = 0$
$S_2$ the curved surface and $S_3$ being the top when $z=b$
I tried to solve the same problem using Gauss Divergence theorem, But It only gives me the integral of $S_2$ , the curved surface.
My question is :
Why can't I use Gauss divergence theorem in this case, I know this theorem can be applied only if the surface is closed, here since my surface is closed theorem is applicable.
But why does Gauss Divergence theorem fail to give accurate answer ?
Can anyone please explain this to me ?
Thank you .
 A: Recall that by divercence theorem we obtain the flux through the whole surface enclosing the volume but in that case we are looking for the flux through the cylinder and bases surfaces included in the first octant.
Indeed by divergence theorem we obtain:
$$F=\int_V -3y^2 dV=\int_{0}^{\pi/2}\int_{0}^{a}\int_{0}^{b}-3r^3\sin^2\theta \:dz\:dr\:d\theta=-\frac{3a^4b\pi}{16}$$
And by direct calculation for the whole surface enclosing the volume:
$$F_1=\int_{S_1} \vec {F}\cdot (-\vec i)dS=0$$
$$F_{2,1}=\int_{S_{2,1}} \vec {F}\cdot \vec n \;dS
=\int_{S_{2,1}} (z\hat{i} +x\hat{j})\cdot \frac{x\hat{i} +y\hat{j}}{a}\;dS
=\int_{S_{2,1}} (xz+xy)\;dS=
\\=\int_{0}^{\pi/2}\int_{0}^{b} (az\cos \theta+a^2\cos\theta \sin \theta)  \;dz\;d\theta =\int_{0}^{\pi/2} \left(\frac12ab^2\cos \theta+a^2b\cos\theta \sin \theta\right)  \;d\theta =
\\=\frac12ab^2+\frac12a^2b$$
$$F_{2,2}=\int_{S_{2,2}} \vec {F}\cdot (-\vec {j}) \;dS
=\int_{S_{2,2}} -x \;dS=\int_{0}^{a}\int_{0}^{b}-x \;dz\;dx=-\frac12a^2b$$
$$F_{2,3}=\int_{S_{2,3}} \vec {F}\cdot (-\vec {i}) \;dS
=\int_{S_{2,2}} -z \;dS=\int_{0}^{a}\int_{0}^{b}-z \;dz\;dx=-\frac12ab^2$$
$$F_3=\int_{S_3} \vec {F}\cdot \vec k\;dS=\int_{S_3} -3y^2b\;dS=-3\int_{0}^{\pi/2}\int_{0}^{a}r^3b\sin^2 \theta\;dr\;d\theta =-\frac{3a^4b\pi}{16}$$
$$F=F_1+F_2+F_3=-\frac{3a^4b\pi}{16}$$
which agrees with the result obtained by divergenge theorem.
