Use cylindrical coordinates to find the volume of the solid using triple integrals The given rectangular equations are
$$x^2+y^2+z^2=64$$
$$(x-4)^2+y^2=16$$
Converting to cylindrical coordinates I get
$$r^2+z^2=64$$
$$r=4cos(\theta)$$
So my triple integral is
$$4\int_0^{\frac{\pi}{2}}\int_0^{4\cos(\theta)}\int_0^{\sqrt{16-r^2}}rdzdrd\theta$$
It's a long and tedious calculation but I worked through it and got $-\frac{1408\pi}{15}$ which doesn't make sense because you can't have a negative volume. The negative came from the second integral which is
$$4\int_0^{\frac{\pi}{2}}\int_0^{4\cos(\theta)}r\sqrt{16-r^2}drd\theta$$
where I used a u-sub, where $u=16-r^2$ and $du=-2r$ and moving that $-\frac{1}{2}$to the outside gives me
$$-2\int_0^{\frac{\pi}{2}}\int_0^{4\cos(\theta)}\sqrt{u}dud\theta$$
So could I just swap the limits of integration to get rid of it or have I messed up somewhere else?
 A: There are two mistakes I notice. You have written wrong bound of $z$ and the equation of cylinder that was already pointed out. The correct integral should be
$V = 4\displaystyle \int_0^{\frac{\pi}{2}}\int_0^{8\cos(\theta)}\int_{0}^{\sqrt{64-r^2}}rdzdrd\theta \approx 617.22$
$V = 4\displaystyle \int_0^{\frac{\pi}{2}}\int_0^{8\cos(\theta)} r \, \sqrt{64-r^2} \, dr \, d\theta$
On substition, $64-r^2 = u, rdr = -\frac{1}{2}du$.
The bound $r = 0$ becomes $u = 64$, $r = 8 \cos \theta$ becomes $u = 64 \sin ^2 \theta$.
$V = -2\displaystyle \int_0^{\frac{\pi}{2}}\int_{64}^{64\sin^2(\theta)} \sqrt u \, du \, d\theta = 2\int_0^{\frac{\pi}{2}}\int_{64\sin^2(\theta)}^{64} \sqrt u \, du \, d\theta$
$V = \displaystyle \frac{2048}{3} \int_0^{\frac{\pi}{2}} (1-sin^3 \theta) \, d\theta = \frac{2048}{3} (\frac{\pi}{2} - \frac{2}{3})$
A: Continuing @MathLOver's calculation, the volume is$$\begin{align}4\int_0^{\pi/2}d\theta\int_0^{8\cos\theta}r\sqrt{64-r^2}dr&=4\int_0^{\pi/2}d\theta\left[-\frac13(64-r^2)^{3/2}\right]_0^{8\cos\theta}\\&=\frac{2^{11}}{3}\int_0^{\pi/2}d\theta(1-\sin^3\theta)\\&=\frac{2^{11}}{3}\int_0^{\pi/2}d\theta(1-\sin\theta+\sin\theta\cos^2\theta)\\&=\frac{2^{11}}{3}\left[\theta+\cos\theta-\frac13\cos^3\theta\right]_0^{\pi/2}\\&=\frac{1024}{9}\left(3\pi-4\right)\\&\approx617.22.\end{align}$$
