<s>[INST] Calculate the volume of the solid determined by $S_1$ and $S_2$ I want to calculate the volume of the solid determined by this tho surfaces:
$$S_1=\{(x,y,z)\in\mathbb{R}:x^2+y^2+z^2=R^2\}$$
$$S_2=\{(x,y,z)\in\mathbb{R}:x^2+y^2=Rx\}$$
The solid is the intersection of a sphere of radius $R$ ($S_1$) and a cylinder of diameter $R$ (centered in $(R/2,0,0)$)($S_2$)
I guess i must change to spherical or cylindrical coordinates, and that's what i have problems with. I'm stucked in finding the new values of the variables. Also, which coordinate system will work better for this problem? Spherical or cylindrical? I will thank any help.
 [/INST] I use cylindrical coordinate to obtain the answer.
For $S_2$, if $x^2+y^2=Rx$ a, then we have $r^2=Rr\cos \theta$, hence $r=R\cos \theta$.
The intersection region involves the first and fourth quadrant.
Hence, we want to evaluate 
\begin{align}
\int_{-\frac{\pi}2}^\frac{\pi}2 \int_0^{R\cos \theta} \int_{-\sqrt{R^2-r^2}}^{\sqrt{R^2-r^2}} r\, dz \,dr \, d\theta 
\end{align}
By using symmetry, we can simplify the expression to 
\begin{align}
&4\int_{0}^\frac{\pi}2 \int_0^{R\cos \theta} \int_{0}^{\sqrt{R^2-r^2}} r\, dz \,dr \, d\theta \\
&= 4\int_{0}^\frac{\pi}2 \int_0^{R\cos \theta} r\sqrt{R^2-r^2}  \,dr \, d\theta \\
&=-2\int_{0}^\frac{\pi}2 \int_0^{R\cos \theta} (-2r)\sqrt{R^2-r^2}  \,dr \, d\theta \\
 &=-\frac43\int_{0}^\frac{\pi}2 \left[(R^2-r^2)^\frac32 \right]_0^{R\cos \theta} \, d\theta \\
&= - \frac43 \int_0^\frac{\pi}2 (R^3\sin^3 \theta - R^3) \, d\theta \\
&= \frac{4}{3}R^3 \int_0^\frac{\pi}2 (1-\sin^3 \theta) \, d\theta \\
&=\frac{4}{3}R^3 \int_0^\frac{\pi}2 (1-\sin \theta(1-\cos^2\theta)) \, d\theta \\
&= \frac{4}{3}R^3 \int_0^\frac{\pi}2 (1-\sin \theta- (-\sin \theta)\cos^2\theta) \, d\theta \\
&= \frac43 R^3\left[ \theta +\cos \theta- \frac{\cos^3 \theta}{3}\right]_0^\frac{\pi}2 \\
&= \frac43 R^3\left[\frac{\pi}2-1+\frac13 \right] \\
&= \frac{2(3\pi-4)}9 R^3
\end{align}
Remark: In the event that $R$  is not specified to be a nonnegative quantity such as radius or diameter, that is if $R$ can take negative value, by symmetry, the answer is $\frac{2(3\pi-4)}9 |R|^3$
</s>