Evaluate $$\int_0^R\int_0^\sqrt{R^2-x^2} e^{-(x^2+y^2)} \,dy\,dx$$
using polar coordinates.
My answer is $-\frac{1}{2}R(e^{-R^2+x^2}-1)$ but I want to confirm if that's correct
And also, when I change from $dy\,dx$ to $dr \,d\theta$ ...how do I know if it should be $dr\,d\theta$ or $d\theta \,dr$?
We want to integrate $$I = \iint_D e^{-(x^2+y^2)} \, dA $$
with $D$ being the region bounded by $0 \le y \le \sqrt{R^2-x^2}$ and $ 0 \le x \le R$. This is a quarter circle of radius $R$ in the first quadrant. In polar coordinates this is equivalent to $0 \le r \le R $ and $0 \le \theta \le \pi/2$. Using a change of variables:
$$ I = \int_0^{\pi/2} \int_0^R e^{-(r^2 \cos^2 \theta + r^2 \sin^2 \theta)} r \, dr \, d\theta \\= \int_0^{\pi/2} \int_0^R r e^{-r^2} dr \, d\theta \\= \int_0^{\pi/2} \left[ -\frac{1}{2} e^{-r^2} \right]_0^R \, d\theta \\= \int_0^{\pi/2} \frac{1}{2} \left( 1 - e^{-R^2} \right) \, d\theta \\= \frac{\pi}{4} \left( 1 - e^{-R^2} \right) $$
To answer your last question, the order of integration doesn't matter because you end up with the same answer. Sometimes one order is easier than the other, depending on the function, but this one is easy either way. Also note that after changing variables you end up with $dA = r \, dr \, d\theta$, not $dr \, d\theta$