Find the volume of the solid inside both $x^2+y^2+z^2=a^2$ and $(x-a/2)^2+y^2=(a/2)^2$ using a triple integral on cylindrical coordinates I am asked to find the volume of the solid inside both $x^2+y^2+z^2=a^2$ and $(x-a/2)^2+y^2=(a/2)^2$ using a triple integral on cylindrical coordinates. 
I have this triple integral setup, which makes so much sense to me. Nonetheless, the result of the integral is not $\frac{2a^3}{9} \left( 3 \pi - 4 \right)$, as it should be according to the book's answer (Larson, 10th ed.)
$$\int_{- \frac{\pi}{2}}^{\frac{\pi}{2}} \int_{0}^{a \cos(\theta)} \int_{- \sqrt{a^2 - r^2}}^{\sqrt{a^2 - r^2}}  \ r \ dzdrd\theta$$
Am I missing something?
Thank you.
 A: In order to better understand the solid region $B$ enclosed by both surfaces in order to better evaluate our limits of integration, we can visualize the surfaces as follows:

In cylindrical coordinates, we can express the cylinder as:
$$ r = a \cos \theta \qquad (0 \leq \theta \leq \pi)$$
and the sphere as:
$$ r^2 + z^2 = a^2$$
We see that, as we traverse all the $(r,\theta)$ or $(x,y)$ points within the cylinder's projection on the $x$-$y$ plane (a circle), the values of $z$ we want are between $\pm\sqrt{a^2-r^2}$
Finally, we recall that:
$$ dV = dx \, dy \, dz = r \, dr \, d\theta \, dz $$
So:
\begin{align*}
\iiint_B \, dV &= \int_{0}^{\pi} \int_0^{a \cos \theta}\int_{-\sqrt{a^2-r^2}}^{\sqrt{a^2-r^2}} r \, dz \, dr \, d\theta \\
&= \int_{0}^{\pi} \int_0^{a \cos \theta} 2\int_{0}^{\sqrt{a^2-r^2}} r \, dz \, dr \, d\theta \\
&= \int_{0}^{\pi} \int_0^{a \cos \theta} 2r\sqrt{a^2-r^2} \, dr \, d\theta \\
&= \int_{0}^{\pi} \left[ -\frac{2}{3}(a^2-r^2)^{3/2} \right]_0^{a \cos \theta} \, d\theta \\
&= \frac{2}{3}\int_{0}^{\pi} (a^3 - a^3 \sin^3 \theta) \, d\theta \\
&= \frac{2a^3}{3}\int_{0}^{\pi} (1 - \sin^3 \theta) \, d\theta \\
&= \frac{2a^3}{12}\int_{0}^{\pi} (4 - 3\sin \theta + \sin 3\theta) \, d\theta \\
&= \frac{a^3}{6} \left[4\theta + 3 \cos \theta - \frac{1}{3}\cos 3\theta  \right]_0^{\pi} \\
&= \frac{a^3}{6} \left(4\pi - 3 + \frac{1}{3} - 3 + \frac{1}{3}  \right) \\
&= \frac{a^3}{6} \left(4\pi - \frac{16}{3}  \right) \\
&= \frac{2a^3}{9} \left(3\pi - 4  \right)
\end{align*}
The problem that you probably ran into is parametrizing from $\theta = -\pi/2$ to $\theta = \pi/2$. This is a valid parametrization, but when you reach this point:
$$ L = \frac{2}{3}\int_{-\pi/2}^{\pi/2} \left[a^3 - (\sin^2 \theta)^{3/2} \right] \, d\theta $$
We have that:
$$ (\sin^2 \theta)^{3/2} \neq \sin^3 \theta $$
for $\sin \theta < 0$, which occurs for $-\pi/2 \leq \theta < 0$.
So we choose a parametrization where we keep $\sin \theta \geq 0$, which is why we use $0 \leq \theta \leq \pi$.
