<s>[INST] Surface integral of a pyramid in a sphere Calculate surface integral: $$I = \iint \limits_{S} \frac{xy}{x^2 + y^2} d{S}$$ where S is surface determined by sides of pyramid $x + y + z = 1 \phantom\ (x, y, z \ge 0 ),$ inside sphere $(x - \frac{1}{2})^2 + (y - \frac{1}{3})^2 + z^2 \le \frac{1}{4}.$
How should I parameterize the surface $S$? I am also having a question regarding the case of the flux integral: How should I find the unit normal vector of the surface $S$?
 [/INST] The parts of the surface that give a non-zero contribution to the integral are
1) the one  over the face $x + y + z = 1$ 
2) the one over the face $z=0$. 
(on the other two faces $x\cdot y=0$ and therefore $f(x,y)=0$). 
As regards $I_1$, we have that $dS=\sqrt{3}dxdy$ and
$$I_1=\sqrt{3}\iint_{D_1}\frac{xy}{x^2 + y^2}\,dxdy$$
where $D_1=\{(x - \frac{1}{2})^2 + (y - \frac{1}{3})^2 +(1-x-y)^2\le \frac{1}{4},y\geq 0,x+y\leq 1\}$.
For $I_2$,  $dS=dxdy$ and
$$I_2=\iint_{D_2}\frac{xy}{x^2 + y^2}\,dxdy.$$
where $D_2=\{(x - \frac{1}{2})^2 + (y - \frac{1}{3})^2 \le \frac{1}{4},y\geq 0,x+y\leq 1\}$.
</s>