Calculate volume of intersection of 2 spheres I need calculate volume of intersection(common part) 2 spheres using integrals. 
First sphere has center [5,0,0] and radius = 5 
second sphere has [15,0,0] and radius = 8
I wrote functions 
$$f_1(x)=\sqrt{5^2-(x-5)^2}$$
$$f_2(x)=\sqrt{8^2-(x-15)^2}$$
I found intersection $$f_1(x)=f_2(x)$$ $$x=\frac{161}{20}$$
I need find volume using integral, but I am not sure if I am using good formula:
$$V=\pi\int_{7}^{\frac{161}{20}}f_2^2(x)dx+\pi\int_{\frac{161}{20}}^{10}f_1^2(x)dx$$
because when i calculate it I got negative result. How can bw volume negative?
How should I calculate volume using integrals?
 A: Hint:
You can solve the problem without integrals.
1) translate the spheres such that one of them has center in the origin (this does not change the volumes): e.g.
$$
x^2+y^2+z^2=25 \qquad (x-10)^2+y^2+z^2=64
$$
2) intersects the two sphere and find the value $x_0$ that is the point on the $x$ axis between which passes the plane of intersection (it is easy).
3) note that the volume that you want is the sum of the volumes of two spherical caps for which you can find the height $h$ and the radius $a$ from the radii of the sphere, the position of the centers and $x_0$ (use symmetries).
4)Calculate the volume of the two caps with the formula 
$$
V=\frac{\pi h}{6}\left( 3a^2+h^2\right)
$$

Using integrals without ''tricks'':
The equations of the spheres are:
$$
(x-c_1)^2+y^2+z^2=R_1^2 \qquad (x-c_2)^2+y^2+z^2=R_2
$$
with $c_1=5$,$c_2=15$, $R_1=5$ and $R_2=8$.
Subtracting the two equations we find the plane that contain the circle of intersection between the two spheres: $x=\frac{161}{20}=b$.
Now see the figure where is represented a section of the two spheres in the $xy$ plane and note that, by symmetry, the figure is the same for the plane $xz$.

we can easily see that $$\alpha=\frac{1}{2}\arccos\left(\frac{b-c_1}{R_1} \right)$$
So we see that the cap after $b$, limited by the sphere of radius $R_1$ has limits, in spherical coordinates:
$$
b\le r\le c_1+R_1 \qquad \frac{\pi}{2}-\alpha\le\theta\le \frac{\pi}{2}+\alpha \qquad -\alpha \le \phi \le \alpha
$$
and the cap before $b$ limited by the sphere of radius $R_2$ has limits:
$$
c_2-R_2\le r\le b \qquad \frac{\pi}{2}-\alpha\le\theta\le \frac{\pi}{2}+\alpha \qquad -\alpha \le \phi \le \alpha
$$
So the volume can be calculated as:
$$
\int_{-\alpha}^{\alpha}\int_{\frac{\pi}{2}-\alpha}^{\frac{\pi}{2}-\alpha}\int_b^{c_1+R_1}r^2\sin\theta dr d\theta d\phi + \int_{-\alpha}^{\alpha}\int_{\frac{\pi}{2}-\alpha}^{\frac{\pi}{2}-\alpha}\int_{c_2-R_2}^{b}r^2\sin\theta dr d\theta d\phi
$$
A: Anwer:
Answer using Cylindrical Coordinates:
Volume of the Shared region = 
Equating both the equations for z, you get x = 161/20.  Now substitute x = 161/20 in in one of the equations and you get r = $3.962$.
Now the sphere is shifted by 10 in the x-direction, Hence
Volume of the Shared region = $$\int_{0}^{2\pi} \int_{0}^{3.962} \int_{15-\sqrt{64-r^2}}^{5+\sqrt{25-r^2}} rdxdrd\theta$$
Which when you evaluate gives you 78.46
Goodluck
