Solution (source code)

= Solution

Since $\boldsymbol a$ is constant, componentwise differentiation gives $\nabla\cdot(\boldsymbol a\phi)=\sum_ia_i\partial_i\phi=\boldsymbol a\cdot\nabla\phi$. Applying the <divergence theorem> to this <vector field> gives
$$
\boldsymbol a\cdot\int_S\phi\,d\boldsymbol S=\boldsymbol a\cdot\int_V\nabla\phi\,dV.
$$
This holds for every constant <vector> $\boldsymbol a$, so the vector integrals agree. This is the <vector gradient form of the divergence theorem>. With $\phi=z$, the <gradient> is the constant unit vector $\boldsymbol e_z$. Therefore
$$
\boxed{\int_S z\,d\boldsymbol S=\frac{4\pi a^2b}3\,\boldsymbol e_z.}
$$