<s>[INST] multivariable calculus, Cartesian coordinate and polar coordinate It's a question about multivariable calculus. My solution differs from the one suggested by the book, and I can understand the solution from the book, yet I cannot figure out where I am wrong...
The question:
$$\iint_D\left|x^2+y^2-2y\right|d\sigma,\ D=\left\{(x,y)\mid x^2 + y^2 \le 4\right\}$$
And my solution:
$$\begin{align}
\iint_D\left|x^2+y^2-2y\right|d\sigma&=2\iint_{D_1}\left|x^2+y^2-2y\right|d\sigma,\, D_1=\left\{(x,y)\mid x^2 + y^2 \le 4,\ x\le0\right\} \\
&=2\int_{\frac{\pi}{2}}^{\frac{3\pi}{2}}d\theta\int_0^2\left|\rho^2-2\rho\sin\theta\right|\rho\,d\rho
\end{align}$$
(switch to polar coordinates)
Then I calculated $\int_0^2\left|\rho^2-2\rho\sin\theta\right|\rho\,d\rho$
$$\begin{align}
\int_0^2\left|\rho^2-2\rho\sin\theta\right|\rho\,d\rho&=\int_0^{2\sin\theta}(2\sin\theta-\rho)\,\rho^2\,d\rho+\int_{2\sin\theta}^2(\rho-2\sin\theta)\,\rho^2\,d\rho \\
&=\left.\left(\frac{2\rho^3\sin\theta}3-\frac{\rho^4}4\right)\right|_0^{2\sin\theta}+\left.\left(\frac{\rho^4}4-\frac{2\rho^3\sin\theta}3\right)\right|_{2\sin\theta}^2 \\
&=4-\frac{16\sin\theta}3+\frac{8\sin^4\theta}3
\end{align}$$
Inserting the result back, we have:
$$\iint_D\left|x^2+y^2-2y\right|\,d\sigma
=2\int_{\frac{\pi}2}^{\frac{3\pi}2}\left(4-\frac{16\sin\theta}3+\frac{8\sin^4\theta}3\right)d\theta
=10\pi$$
Here is the solution suggested by the book:
$$\begin{align}
\iint_D\left|x^2+y^2-2y\right|d\sigma
=&\iint_{D_1}-(x^2+y^2-2y)\,d\sigma+\iint_{D_2}(x^2+y^2-2y)\,d\sigma \\
D_1=\left\{(x,y)\mid x^2+(y-1)^2\le1\right\}&,\ D_2=\left\{(x,y)\mid x^2+y^2\le4,\ x^2+(y-1)^2>1\right\} \\
=&\iint_D(x^2+y^2-2y)\,d\sigma-2\iint_{D_1}(x^2+y^2-2y)\,d\sigma \\
=&\int_0^{2\pi}d\theta\int_0^2(\rho^2-2\rho\sin\theta)\,\rho\,d\rho-2\int_0^{\pi}d\theta\int_0^{2\sin\theta}(\rho^2-2\rho\sin\theta)\,\rho\,d\rho \\
=&\int_0^{2\pi}\left(4-\frac{16\sin\theta}3\right)d\theta-2\int_0^{\pi}\left(-\frac{4\sin^4\theta}3\right)d\theta \\
=&\ 9\pi
\end{align}$$
Thanks in advance!
 [/INST] We have that
$$x^2+y^2-2y=x^2+(y-1)^2-1=0$$
represents a circle $D_1$ centered at $(0,1)$, therefore the function $f(x,y)=x^2+y^2-2y$ is $\le 0$ inside the circle and $\ge 0$ outside.
therefore the correct set up is that given from the book or as an alternative
$$\iint_D (x^2+y^2-2y)\, dS+2\iint_{D_1} (-x^2-y^2+2y)\, dS$$
</s>