This question comes from a previous question on this site. There is the integral $$\int_{-1}^{1}\int_{0}^{\sqrt{1 - x^2}}\int_{0}^{\frac{y}{2}}f(x, y, z) \, dz \, dy \, dx.$$ Our job is to reorder the order of integration so that the differential is $dy \, dx \, dz$.
I thought of $$\int_{0}^{1/2}\int_{-1}^{1}\int_{2z}^{\sqrt{1 - x^2}} f(x, y, z) \, dy \, dx \, dz$$. To check this, I thought to let $f(x, y, z) = 1$. If the two integrals are equivalent, the volume gained by both of them should be the same (because we're integrating over the same region.)
However, placing this into Wolfram Alpha yields different results. There, $$\int_{-1}^{1}\int_{0}^{\sqrt{1 - x^2}}\int_{0}^{y/2}f(x, y, z) \, dz \, dy \, dx = \frac{1}{2},$$ while $$\int_{0}^{1/2}\int_{-1}^{1}\int_{2z}^{\sqrt{1 - x^2}} f(x, y, z) \, dy \, dx \, dz = \frac{1}{4}(\pi - 2).$$
So clearly, there is something wrong with my new integral. However, going into Desmos, I plotted the region of integration of both integrals, and I the two regions looked pretty similar to me. Where did I go wrong here?
The first integral (integration order is $z$, $y$, then $x$) has value $1/3$, not $1/2$, and this is the correct volume.
The second integral is problematic, because the range of $x$ must depend on $z$. It should be
$$\int_{z=0}^{1/2} \int_{x = -\sqrt{1-(2z)^2}}^{\sqrt{1-(2z)^2}} \int_{y=2z}^{\sqrt{1-x^2}} f(x,y,z) \, dy \, dx \, dz.$$
We can see this because when $z = 1/2$, $x = 1$ is not allowed; in fact, the interval for $x$ would comprise the single point $x = 0$. The reason why you get a different answer without this restriction is because the innermost integral $$\int_{y=2z}^{\sqrt{1-x^2}} f(x,y,z) \, dy$$ does not evaluate to $0$ when $2z > \sqrt{1-x^2}$. It is still evaluated and ends up being negative (if $f = 1$), but the intent was that it should be $0$.