# Divergence theorem problem involving spherical polar coordinates

Use the divergence theorem to evaluate the surface intergral $$\iint_S\vec{A}.\vec{n}dS$$ where we know that $$\nabla .\vec{A}=4r\cos^2(\theta)$$ where $S$ is the spherical surface of unit radius centered on the origin.

For my attempt i get $$\iint_S\vec{A}.\vec{n}dS=\int_{r=0}^{r=1}\int_{\theta=0}^{\theta=2\pi}\int_{\phi=0}^{\phi=\frac{\pi}{2}}4r\cos^2(\theta)dV$$ By the divergence theorem where i think that $$dV=r^2\sin(\theta)dr d\theta d\phi$$ For my answer i get $\frac{2\pi}{3}$ but my lecturer has just put his answer only online which he got was $\frac{4\pi}{3}$ i dont understand where i'm going wrong if i am going wrong, i dont undesrtand where he is getting the factor of $2$ from. Any help would be appreciated, Thanks.

Given your answer, I am pretty sure you are confusing two things: First, which angle is represented by which variable. Given your jacobian and the correct answer of $4\pi/3$, I believe you mean $\theta$ to be the angle sweeping from $k$ to $-k$. Second, spherical coordinates require this $\theta$ sweep from $0$ to $\pi$, not $\pi/2$.
Thus, your integral should be $$\int_0^1\int_0^{\pi}\int_0^{2\pi} 4r^3\cos^2(\theta)\sin(\theta)\mathrm d\phi \mathrm d\theta \mathrm dr= 2\pi \int_0^\pi\cos^2(\theta)\sin(\theta) \mathrm d\theta=\frac{4\pi}{3}$$
edit: from context (the answer given by the lecturer) I am going to assume that $\theta$ is the angle sweeping along the z axis.