<s>[INST] Flux and Gauss theorem I have a problem; There seems to be something wrong with my understanding of gauss theorem.
Let's say $F = [y ; x^2y; y^2z]$. I want to calculate the flux of $F$ going out of $$D = \{1 \le z \le 2 - x^2 - y^2\}$$
Method number 1
LEt's use Gauss theorem.
So $\nabla \cdot F = x^2 + y^2$, and $$\int_{D} x^2 + y^2 = \int_{A} \int_1^{2-x^2-y^2} x^2 + y^2 dz = $$ $$\int_{A} (x^2 + y^2)(1 - x^2 - y^2) dxdy= \int_0^1\int_0^{2\pi} \rho ^3(1-\rho^2)) d\rho d\theta = \frac{\pi}{6}$$
Method number 2
LEt's do the explicit calculations.
So let's write $D$ as $r_{up} = [x ; y ; 2 - x^2 - y^2]$ (for the upper part) and $r_{down} = [x ; y; 1]$
This leads to 
$$n_{up} = r_x \wedge r_y = [2x ; 2y ; 1]$$
$$n_{down} = r_x \wedge r_y = [0; 0; -1]$$
(I didn't normalize the normal because in the integral I'm going to write directly $dxdy$ without the norm of $n$)
Then $$\int_{D} F \cdot n_{up} = \int_{D} 2xy + 2x^2y^2 + y^2z = \frac{\pi}{8}$$
and $$\int_{A} F \cdot n_{down} = \int_{A} -y^2 = -\frac{\pi}{4}$$ (where A is the unitary circle)
So the two results are different.
Why is this so?
Thank you in advance
EDIT 
I edited $n_{down}$, which I belive must be pointing out of $D$ so I changed it in $(0, 0, -1)$. This does not change the fact that the twto methods yields different results, though
 [/INST] You have the associated form $$G=ydy\wedge dz+x^2ydz\wedge dx+y^2z dx\wedge dy$$ Then $$dG=({\rm div}\; F)dx\wedge dy\wedge dz=(x^2+y^2)dx\wedge dy\wedge dz$$
Now the flat part of the surface, $S_1$; can be parametrized by $(r\cos t,r\sin t,1)$ with $0\leqslant r \leqslant 1$ and $0\leqslant t\leqslant 2\pi$. The upper cap $S_2$ may be parametrized by $(r\cos t,r\sin t ,2-r^2)$ with the very same domain. We see $dz=0$, so you get  
$$\int\limits_{{S_1}} G  = \int\limits_0^{2\pi } {\int\limits_0^1 {{r^3}{{\sin }^2}tdrdt} }  = \frac{\pi }{4}$$
On the other hand over the upper cap you have  $$\eqalign{
  & dy = \sin tdr + r\cos tdt  \cr 
  & dx = \cos tdr -  r\sin tdt   \cr 
  & dz =  - 2rdr \cr} $$
You can calculate $$dx\wedge dy=rdr\wedge dt\\ dy\wedge dz=2r^2\cos tdr\wedge dt\\dz\wedge dx=2r^2\sin tdr\wedge dt$$  
Then the integral is $$\eqalign{
  & \int_0^1 {\int_0^{2\pi } {\left( {r\sin t\left( {2{r^2}\cos t} \right) + {r^3}{{\cos }^2}t\sin t\left( {2{r^2}\sin t} \right) + {r^2}{{\sin }^2}t\left( {2 - {r^2}} \right)r} \right)dtdr} }  =   \cr 
  & \int_0^1 {\int_0^{2\pi } {\left( {2{r^5}{{\cos }^2}t{{\sin }^2}t + {{\sin }^2}t\left( {2 - {r^2}} \right){r^3}} \right)dtdr} }  =   \cr 
  & \int_0^{2\pi } {\left( {\frac{2}{6}{{\cos }^2}t{{\sin }^2}t + {{\sin }^2}t\frac{1}{3}} \right)dt}  = \frac{2}{6}\frac{\pi }{4} + \frac{\pi }{3} = \frac{\pi }{{12}} + \frac{\pi }{3} =\frac{5\pi}{12}\cr} $$
Then our answers match up $$\frac{5\pi}{12}-\frac{\pi}4=\frac{5\pi}{12}-\frac{3\pi}{12}=\frac{2\pi}{12}=\frac \pi 6$$
</s>