# Verifying divergence theorem for the field $F=(x+y)i+j(y+z)+k(z+x)$ and the cylinder $x^2+y^2=9$

I'm trying to verify the divergence theorem for the vector field $$F=(x+y)i+j(y+z)+k(z+x)$$ in the region $$0\leq x^2+y^2 \leq 9\\ 0\leq z\leq 5$$ I got the the divergence integral equal to $$135\pi$$ which is the book's answer. But I got the wrong result for the flux across the cylinder.

Here are my calculations:

For the cylinder I projected the surface in the xz-plane $$\iint F \cdot n d\sigma= \iint \frac{(9+xy+yz)}{y} dz dx$$

Where $$n=\frac{x\hat{i}+y\hat{j}}{\sqrt{x^2+y^2}}$$,

$$y=\pm \sqrt{9-x^2}$$. For each value of y I've evaluated

$$\int_{-3}^{3} \int_{0}^{5} (\frac{9}{y}+x+z )dzdx$$

I got the sum of the flux of the two surface integrals equal to

$$45\pi+75+(-45\pi+75)$$
I added this to the sum of the flux of the upper surface($$z=5$$) and lower surface($$z=0$$)

For the upper surface I got flux equal $$45\pi$$ and for lower surface I got flux equal to $$0$$ But the net flux doesn't equal to the divergence

Where was I wrong?

Your calculations of the flux through the upper and lower surfaces are correct. I couldn't follow your calculation of the flux through the cylindrical surface, but in any event, it's easier to change to cylindrical coordinates, I think. With $$(x,y,z)=(3\cos{\theta}, 3\sin{\theta},z)$$ we have $$\vec{n}=\cos{\theta}\vec{i}+\sin{\theta}\vec{j}$$ so that\begin{align} F\cdot\vec{n}&= (3\cos{\theta}+3\sin{\theta})\cos{\theta}+(3\sin{\theta}+z)\sin{\theta} \\ &=3+3\sin{\theta}\cos{\theta}+z\sin{\theta} \end{align} Since the surface element is $$3\mathrm{d}z\mathrm{d}\theta$$, the flux through the cylindrical surface is $$\int_0^{2\pi}\int_0^5(3+3\sin{\theta}\cos{\theta}+z\sin{\theta})3\mathrm{d}z\mathrm{d}\theta$$ which is easily evaluated to be $$90\pi$$.