A solid $D$ is defined by the following inequalities: $$\begin{align}x^2+y^2+(z-1)^2 &\le 1\\ z^2 &\le x^2+y^2\end{align}$$ Calculate the volume of $D$.
Attempt to solve:
$$\begin{align}x&=r\cos\theta \\ y&=r\sin\theta\end{align}$$
Plugging in these values into the first equation we get :
$$\begin{align} r^2+(z-1)^2&=1 \\ (z-1)^2&=1-r^2 \\ z&=1\pm\sqrt{1-r^2} \end{align}$$
Since $z^2=r^2$ from the 2nd inequality, we'll have $z=\pm r$.
Solving for $r$:
$$r=1+\sqrt{1-r^2} \implies r=1$$
and $0<\theta<2\pi$.
However, I'm confused about how to define the limits of $z$ since it could be equal to $1+\sqrt{1-r^2}$ or $1+\sqrt{1-r^2}$.
Thanks in advance.
Since $\theta$ does not occur in either inequality, we indeed have to cover the full range $0 \leq \theta < 2 \pi$ when integrating. The first inequality implies $ r \leq 1$ and the second one gives no further constraints (since $z=0$ is possible), so we have $0\leq r \leq 1$.
Finding the correct bounds for $z$ is harder, as they depend on $r$. The first inequality yields $$ \tag{1} |z-1| \leq \sqrt{1-r^2} $$ and from the second one we get $$\tag{2} |z| \leq r \, .$$ It is helpful to consider two extreme cases first. Putting $r=0$ in $(1)$ yields $|z-1| \leq 1$ or $ z \in [0,2]$. Substituting $r=1$ into $(2)$ we get $|z| \leq 1 $ or $z \in [-1,1]$. Combining these findings we obtain the preliminary result $z \in [0,1]$.
But now we can remove the absolute value bars in $(1)$ and $(2)$ by recognising that $|z-1| = 1 -z$ and $|z|=z$ hold for $z \in[0,1]$. Rearranging the inequalities then gives the correct limits: $$ 1 - \sqrt{1-r^2} \leq z \leq r \, .$$