I want to compute the mass of the region between the sphere \begin{equation} x^2 + y^2 + z^2 = 9 \end{equation} and the hyperboloid \begin{equation} x^2 + y^2 - z^2 = 1 \end{equation} for $z \geq 0$ and with density $\rho(x,y,z)=z $
When I calculate this with triple integrals in cylindrical coordinates, I get \begin{equation} \int_{0}^{2\pi} \int_{0}^{\sqrt{5}} \int_{\sqrt{r^2-1}}^{\sqrt{9-r^2}} z.r \, dz \, dr \, d\theta = \frac{25\pi}{2} \end{equation}
But if I reverse the order, putting $r$ before $z$ and splitting into two regions: \begin{equation} \int_{0}^{2\pi} \int_{0}^{2} \int_{0}^{\sqrt{1+z^2}} z.r \, dr \, dz \, d\theta + \int_{0}^{2\pi} \int_{2}^{3} \int_{0}^{\sqrt{9-z^2}} z.r \, dr \, dz \, d\theta = \frac{49\pi}{4} \end{equation}
Why did I get that difference?
When $r < 1$, the lower terminal of the $\mathrm{d}z$ integral should be $0$, not $\sqrt{r^2 - 1}$ (which isn't even real). The correct form of the first version of the triple integral is $$ \int_0^{2\pi} \int_0^{\sqrt{5}} \int_{\sqrt{\max\{r^2-1, 0\}}}^{\sqrt{9 - r^2}} rz\, \mathrm{d}z\, \mathrm{d} r\, \mathrm{d}\theta, $$ which indeed is $49\pi/4$.