<s>[INST] Volume of sphere inside a cylinder I have homework question:
Calculate the volume of $\{(x,y,z) \mid x^2+y^2+z^2\le (2a)^2\} \cap \{(x,y,z) \mid (x-a)^2 + y^2 \le a^2\}$ 
in two ways:
1) Polar coordinates
2) Spherical coordinates
How can I solve it?
Edit: What I tried:
$$2\int_0^{2\pi}\int_0^a r\sqrt{4a^2-x^2-y^2}\,dr\,d\theta = 2\int_0^{2\pi}\int_0^a r\sqrt{4a^2-(a+r\cos\theta)^2-r\sin^2\theta}\,dr\,d\theta \\
= 2\int_0^{2\pi}\int_0^a r\sqrt{3a^2-2ar\cdot\cos\theta - r^2}\,dr\,d\theta = \: ?$$
Edit: I need answer with one of the two ways.
 [/INST] For cylindrical coordinates:
$$z=\pm \sqrt{4a^2-(x^2+y^2)}$$
Using polar coordinates
$$x=r\cos\phi  \ , \ y=r\sin \phi $$
we end up with
$$z=\pm \sqrt{4a^2-r^2}$$
now, just integrate
$$\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\int_0^{2a\cos \phi}\int_{-\sqrt{4a^2-r^2}}^{\sqrt{4a^2-r^2}}rdzdrd\phi=2\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\int_0^{2a\cos \phi}r\sqrt{4a^2-r^2}dzdrd\phi$$
For spherical coordinates:
$$ x=r\cos\phi \sin \theta \ , \ y = r\sin \phi \sin \theta \ , \ z = r\cos \theta \ , \ J=r^2\sin \theta $$
</s>