# Find the Volume lying inside both the sphere $x^2+y^2+z^2=a^2$ and the cylinder $x^2+y^2=ax$

Taking the equation for the cylinder I completed the square to find $(x-\frac{a}{2})^2+y^2=\frac{a^2}{4}$ and the sphere clearly has radius $a$ and is centered at the origin. Now to solve this question we express the radius in terms of theta using the equation for the cylinder (giving $r=a\cos\theta$) and then we solve for $z$ in the sphere's equation giving $z=\sqrt{a^2-x^2-y^2}=\sqrt{a^2-r^2}$ and setup the integral as follows (multiplying by 4 since we only consider the first octant but the total area is in 4 octants): $$4\int_0^{\frac{\pi}{2}}\int_0^{a\cos\theta}\sqrt{a^2-r^2}rdrd\theta$$

This is the part I don't understand, why exactly do we express the radius in terms of the cylinder and then why do we solve for $z$ in terms of the sphere and integrate that? Clearly it gives the volume contained but I can't fathom how.

• Can you picture what this region looks like? The point of solving those equations is the get the right bounds for the iterated integral. – Justin Benfield Mar 14 '16 at 17:06
• Yea I can graph it perfectly but I just don't really understand the method – Craig Mar 14 '16 at 17:10
• Because the cylinder bounds $r$, you need to express it in polar coordinates in order to get the upper bound of the integral on the inside. They solve for $z$ in the sphere because the sphere determines the vertical bound for the volume to be found (this is why it is the integrand of the inside integral). – Justin Benfield Mar 14 '16 at 17:17
• I'm having trouble understanding why their upper bound for the outer integral is $2\pi$ and not $\frac{\pi}{2}$. – Justin Benfield Mar 14 '16 at 17:20
• ah sorry I copied that wrong – Craig Mar 14 '16 at 17:24

Conceptually, what this integral is doing is this: Start at the origin, then move out until you reach $a\cos \theta$. This draws a line segment, and is what the inner integral does. Then the outer integral, takes that line segment, and sweeps out the semi-circular arc which goes from the point (in rectangular coordinates) $(a,0,0)$ to the point $(0,0,0)$ (also in rectangular coordinates). This gives the area of the semicircle. Finally, the integrand itself gives the height above this semicircular region to the sphere, thereby filling in the desired volume. Note that this is only $\frac{1}{4}$ of the total desired volume, hence we multiply by $4$ to get the entire volume. Does that make sense? All iterated integrals can be thought of in this way (This fact is captured most generally by the generalized Stokes' Theorem).