<s>[INST] Finding the outward flux through a sphere Problem:

Find the flux of of the field $F$ across the portion of the sphere $x^2 + y^2 + z^2 = a^2$ in the first octant in the direction away from the origin, when $F = zx\hat{i} + zy\hat{j} + z^2\hat{k}$.

 [/INST] The way you calculate the flux of $F$ across the surface $S$ is by using a parametrization $r(s,t)$ of $S$ and then
$$
\int\!\!\!\!\int_S F\cdot n\, dS = 
\int\!\!\!\!\int_D F(r(s,t))\cdot (r_s\times r_t)\, dsdt,
$$
where the double integral on the right is calculated on the domain $D$ of the parametrization $r$. 
In this case, since $S$ is a sphere, you can use spherical coordinates and get the parametrization 
$$
r(\theta, \phi)=(a\cos\theta\sin\phi, a\sin\theta\sin\phi, a\cos\phi),\ \ 0\leq\theta\leq\frac\pi2,\ \ 0\leq\phi\leq\frac\pi2.
$$
The "first octant" is chosen by the region where we let $\theta$ and $\phi$ vary (if you think carefully about it you'll see that $\pi/2$ is the right choice above). 
Now the partial derivatives:
$$
r_\theta=(-a\sin\theta\sin\phi,a\cos\theta\sin\phi, 0),\ \ \ r_\phi=(a\cos\theta\cos\phi, a\sin\theta\cos\phi, -a\sin\phi).
$$
The normal vector:
\begin{eqnarray}
r_\theta\times r_\phi&=&\left|\begin{matrix}i& j& k\\ 
-a\sin\theta\sin\phi&a\cos\theta\sin\phi& 0\\ a\cos\theta\cos\phi& a\sin\theta\cos\phi& -a\sin\phi
\end{matrix}\right|
\\ \ \\ 
&=&(-a^2\cos\theta\sin^2\phi, -a^2\sin\theta\sin^2\phi, -a^2\sin\phi\cos\phi).
\end{eqnarray}
Since we want the direction away from the origin, we need to reverse the signs in the normal vector.
Now
\begin{eqnarray}
F(r(\theta,\phi))\cdot(r_\theta\times r_\phi)&=& 
(a^2\cos\theta\sin\phi\cos\phi,a^2\sin\theta\sin\phi\cos\phi,a^2\cos^2\phi) \\
& &\cdot(a^2\cos\theta\sin^2\phi, a^2\sin\theta\sin^2\phi, a^2\sin\phi\cos\phi)
\\ &=&
a^4\cos^2\theta\sin^3\phi\cos\phi+a^4\sin^2\theta\sin^3\phi\cos\phi+a^4\sin\phi\cos^3\phi\\
&=&
a^4\sin\phi\cos\phi(\cos^2\theta\sin^2\phi+\sin^2\theta\sin^2\phi+\cos^2\phi)\\
&=&a^4\sin\phi\cos\phi.
\end{eqnarray}
Finally,
$$
\int\!\!\!\!\int_S F\cdot n\, dS = \int_0^{\pi/2}\!\!\int_0^{\pi/2}a^4\sin\phi\cos\phi\,d\theta d\phi=\frac\pi2\,a^4\left.\frac{\sin^2\phi}2\right|_0^{\pi/2}=\frac{\pi a^4}4
$$
</s>