Polar coordinates confusion This seems to be very easy, however I cannot understand, where I am mistaking. Here's the integral to be computed:
$$\iint_Dx^2+y^2dydx$$ 
with $D:=\left\{(x,y)\in \mathbb{R}^2:x \ge0, \; x^2+y^2-2y\leq0\right\}$
Clearly this integral can be written as $$\int_0^1\!\!\!\int_0^2x^2+y^2dydx={10\over 3}$$
However when I try to switch to polar coordinates I get a different result. The integral in polar coordinates is $$\int_0^2\!\!\!\int_{-{\pi\over2}}^{{\pi\over2}}r^3d\phi dr$$
which yields the integral to be equal $4\pi$.
What is wrong?
 A: There seems to be some lingering unclarity about the parametrization of the region $D$. This is what it looks like:

Here I used the polar equation $r=2\sin\phi$ for the circular boundary of $D$. In the figure there are lines for constant values of $\phi$. You see that along such a ray, originating from the origin and pointing at the direction $\phi$, the distance from the origin grows from $r=0$ to $r=2\sin\phi$. You also see that the directions of those rays vary in the range $0\le\phi\le\pi/2$. Therefore the integral that you need to calculate is
$$
I=\int_{\phi=0}^{\pi/2}\int_{r=0}^{2\sin\phi}r^2\cdot r\,dr\,d\phi.
$$
If you want to the integration using cartesian coordinates, then it is natural to observe that $x$ ranges over the interval $[0,1]$. Then you need to keep in mind that
for a given value of $x$, the range of values for $y$ is from $1-\sqrt{1-x^2}$ (=the lower boundary of $D$) to $1+\sqrt{1-x^2}$ (=the upper boundary of $D$). Thus
$$
I=\int_{x=0}^1\int_{y=1-\sqrt{1-x^2}}^{1+\sqrt{1-x^2}}(x^2+y^2)\,dy\,dx.
$$
It is a useful exercise to check that you get the same value for this integral whichever way you do it.
The general phenomenon that you ABSOLUTELY must learn here is that the boundaries for the inner integral (the integration that you do first) may, and usually will, depend on the variable of the outer integration. The boundaries of the outer integral OTOH must be constants.
If you mistakenly do the polar integral with boundaries $-\pi/2\le\phi\le\pi/2$, $0\le r\le 2$, you will be integrating over a much larger semicircle, namely the half $x\ge0$ of the disk $x^2+y^2\le 4$. Below is a figure showing this larger area with the correct region $D$ on top of it.

A: $$
D = 
\left\{
x,y: x\ge 0, y^2 - 2y + 1 \le 1 - x^2
\right\}
= 
\left\{
x,y: x\ge 1, (y-1)^2 \le 1 - x^2
\right\}
$$
is half of the circle of radius 1 and center $(0,1)$.

In polar coordinates 
$$
D = \left\{
r,\theta: 0\le\theta \le \frac\pi 2, 
0\le r\le 2\sin\theta
\right\}
$$
$$
I = \int_{\theta=0}^{\frac\pi 2}\int_{r=0}^{2\sin\theta} r^2 rdrd\theta
= \int_{0}^{\frac\pi 2} \frac{2^4\sin^4\theta}4 d\theta
= 4\int_{0}^{\frac\pi 2} \sin^4\theta d\theta
=\frac{3\pi}4
$$
A: The integration domain in $\int_0^1\!\!\!\int_0^2x^2+y^2dydx$ is a rectangle!
