Sorry for the bad title, couldn't think of a less convoluted way of writing it.
I have to find $ R\in \mathbb{R}$ so that the flux of $$F(x,y,z) = (xz - x\cos(z), -yz +y\cos(z), -4 - (x^2 + y^2)) $$
Over $S_R = \{ x^2 + y^2 + z^2 = R^2 , z \geq 0 \} $
I started doing the more obvious calculation.
$$ \nabla \cdot F = z - \cos z -z + \cos z + 0 = 0$$
Which must be wrong, since then R wouldn't matter. I started working the other way around, calculating $$\int _0 ^{2\pi} \int_0 ^{\frac{\pi}{2}} F(R\cos \theta \sin \phi, R\sin \theta \sin \phi, R\cos \phi) \cdot T_\theta \times T_\phi d\phi d\theta$$
But at some point I get a malicious $\cos (R \cos\phi)$ that doesn't cancel out like I hoped.
I'm sure there's some basic error I'm making here, but can't seem to find it. This is my first time dealing with maximization problems like this and I'm really at a loss on how to face it.
Any help would be greatly appreciated.
This can be done with the divergence theorem. Since $\nabla\cdot F=0$, the flux of the vector field though the closed surface given by the union of the upper hemisphere and the equator $E=\{(x,y,z):z=0,x^2+y^2\leq R^2\}$ is zero. Hence the flux of $F$ through the upper hemisphere equals the opposite of the flux of $F$ through $E$: $$\Phi(F) = \int_{x^2+y^2\leq R^2}(4+x^2+y^2)\,d\mu = 4\pi R^2+\int_{0}^{2\pi}\int_{0}^{R}\rho^3\,d\rho\,d\theta = 4\pi R^2+\frac{\pi}{2}R^4.$$ Since the RHS is an increasing function of $R$, the flux has no maximum.