I have a ball that intersects a cylinder and I need the volume. How do I do it? I have an exam coming up and I am stressing out about it really hard. I don't even know how to actually do this. Is it a triple integral?
I have a ball $\{(x,y,z)|x^2 + y^2 + z^2 \leq 9\}$ and a cylinder $\{(x,y,z) | x^2 + y^2 \leq 5,  0 \leq z \leq 3\}$. The volume V is obtained by intersecting the ball and the cylinder. Compute V.
 A: One approach would be to set it up in cylindrical coordinates to get
$\;\;\;\displaystyle\int_0^{2\pi}\int_0^{\sqrt{5}}\sqrt{9-r^2}r\;drd\theta$.
Another way to do this is to note that the solid is made up of a cylinder with a spherical cap on top, 
so the volume is given by
$\displaystyle V=V_1+V_2=\pi(\sqrt{5})^2(2)+\int_2^3\pi(9-z^2)dz=10\pi+\frac{8}{3}\pi=\frac{38\pi}{3}$
A: Let's start with picking convenient coordinate system. Since the $Oz$ axis is an axis of symmetry for both of the bodies, let's consider cylindrical coordinate system $(r, \theta, z)$ with $r = \sqrt{x^2+y^2}$ so $x = r \cos \theta, y = r \sin \theta$.
Now the ball $B$ is described as $r^2 + z^2 \leq 3^2$ and the cylinder as $r^2 \leq 5, 0 \leq z \leq 3$. Note how nicely $\theta$ disappeared.
The volume V is given by this tripple integral:
$$
V = \iiint\limits_{\substack{x^2+y^2+z^2 \leq 3^2\\x^2+y^2\leq 5\\0 \leq z \leq 3}} dxdydz = \iiint\limits_{\substack{r^2+z^2 \leq 3^2\\r^2\leq 5\\0 \leq z \leq 3}} rdrd\theta dz = 2\pi \iint\limits_{\substack{r^2+z^2 \leq 3^2\\r^2\leq 5\\0 \leq z \leq 3}} rdrdz.
$$
Since integral function and region don't depend on $\theta$ the integral became double and $2\pi$ arose from integrating by $\theta$.
$$
V = 2\pi\int\limits_0^3 dz \int\limits_0^\sqrt{\min(5,9-z^2)} rdr =
2\pi\int\limits_0^3 \frac{\min(5,9-z^2)}{2} dz =
2\pi\int\limits_0^2 \frac{5}{2} dz +
2\pi\int\limits_2^3 \frac{9-z^2}{2} dz = \\ =
10\pi + \frac{8\pi}{3} = \frac{38\pi}{3}
$$
