# Overlapping spheres

Say you have two spheres that are partially overlapping. How would I find the volume of the portion of one of the spheres that is not overlapping with the other based on how far apart the two spheres are and the spheres' individual radii?

You can see this at Mathworld or $V^{(2)}$ under Application in Wikipedia

If $d<r_1+r_2$ is the distance between the two sphere centers ... of two intersecting spheres of radii $r_1$ and $r_2$, ... $$V^{(2)} = \frac{\pi}{12d}(r_1+r_2-d)^2\left(d^2+2d(r_1+r_2)-3(r_1-r_2)^2\right)$$ is the sum of the two spherical caps of the intersection.

• I edited your answer to include the formula, as it is preferable that answers be self-contained. I also want to point out for the benefit of the asker that (i) the volume of the portion of one sphere not overlapping the other is simply the volume of the former sphere minus the intersection volume above, as in @rlgordonma's answer, and (ii) the formula will only work correctly if the surfaces of both spheres are intersecting, i.e. $\lvert r_1-r_2\rvert\le d\le r_1+r_2$.
– user856
Feb 8, 2013 at 6:51
• @ℝⁿ. : Thanks .... Feb 8, 2013 at 14:04

Assume that the 2 spheres have equal radii. The volume of the intersection is given by

$$V_I = 2 \pi \int_{-a}^{-d/2} dx \: (a^2-x^2)=\frac{4 \pi}{3} a^3-\pi d \left (a^2-\frac{d^2}{12}\right)$$

where $a$ is the radius of each sphere and $d$ is the separation between the centers of the spheres. So the volume in a sphere outside of the intersection is

$$\pi d \left (a^2-\frac{d^2}{12}\right)$$

For the general case, assume that the spheres have radii $a$ and $b>a$. The geometry of the intersection is a lens of thickness $d$, the thickness of the lens surface of radius $a$ being

$$t_a = \frac{a^2-(b-d)^2}{2 d}$$

and that of the lens surface of radius $b$ is

$$t_b = \frac{b^2-(a-d)^2}{2 d}$$

The volume of the lens is then

\begin{align}V_I &= \pi \int_{a-t_a}^a dx \: (a^2-x^2) + \pi \int_{-b}^{-b+t_b} dx \: (b^2-x^2)\\ &=\frac{\pi}{12 d}(a+b-d)^2 \left(2 d (a+b)+9 (b-a)^2+d^2\right) \end{align}

To get the volume outside of this lens in either sphere, subtract $V_I$ from either $\frac{4 \pi}{3} a^3$ or $\frac{4 \pi}{3} b^3$.

• I don't think the answer specifies that the radii are equal. // Even if they are, your solution doesn't match the references in Ross's answer, and gives zero volume of intersection when the spheres are coincident.
– user856
Feb 8, 2013 at 4:55
• @$\mathbb{R}^n$: thanks, error corrected. Limiting cases check out. As for the spheres being equal, well, I'll leave it to the OP to verify the scope of the problem. Feb 8, 2013 at 5:19
• So what if the radii are not equal? Replace 'a^2' with 'a*b' for each radius? Feb 8, 2013 at 5:40
• @Waffle: I don't think it is that simple. The geometry gets somewhat complicated. It is doable, and if you interested, I will show it. Feb 8, 2013 at 5:53
• What I'm really trying to do is have one sphere come out of another sphere at a constant speed, where after the sphere is completely out of the other sphere, the total volume (with half the mass of the overlapping space) never changes, and the two spheres end up with equal volumes. This was the first possible equation I thought I might need, but I'm not exactly sure if I'm going the right way. Feb 8, 2013 at 5:59