What is a sphere difference?
A sphere difference is what is left of a solid ball A of radius a after removing every point that also lies inside a second ball B of radius b, whose centre is at the distance c from the centre of A. The two spheres must cross, so c lies between |a − b| and a + b. The body is ball A: its surface is the outer zone of sphere A plus a concave cap of sphere B that forms a hollow, and the two meet in a circle. The removed part is a lens, the overlap of the two balls.
This calculator finds the volume, the surface area, the surface-to-volume ratio, the position and radius of the cut circle, the height of the cap of A that is removed, the depth of the hollow, the length of the body along the line of the centres and the areas of the outer zone and of the hollow.
How to use it
Enter the radius a of the ball that remains, the radius b of the ball that is removed and the distance c between the centres. If c is at least a + b the balls do not overlap; if c is at most the difference of the radii one ball lies inside the other. Both cases are refused. Every measure is solved from the values you enter. The length unit is a label only: lengths are shown in that unit, areas in its square and volumes in its cube. The page shows results rounded to at most 6 decimal places and writes values from 10¹² up as a 12-digit number times a power of ten, such as 1.23456789012 × 10¹², and very small values out in full.
Derivation of the formulas
Put the centre of A at 0 and the centre of B at c on one axis, and let x be the position along it. A point at the position x and at the distance ρ from the axis lies on both spheres when x² + ρ² = a² and (x − c)² + ρ² = b²; taking one from the other gives a² − x² = b² − (x − c)², so the spheres meet in the plane at
$$x = \frac{c^2 + a^2 - b^2}{2c}$$Sphere A keeps its part on the far side of this plane (heights from −a to x) and loses the cap of height kA = a − x; sphere B contributes its part on the near side, a cap of height hB = x − (c − b). Both heights factor without cancellation:
$$k_A = \frac{(a + b - c)(b + c - a)}{2c}, \qquad h_B = \frac{(a + b - c)(a + c - b)}{2c}$$The outer zone of A has the height g = 2a − kA = a + x, which factors in the same way:
$$g = \frac{(a + c - b)(a + b + c)}{2c}$$By Archimedes the zone has the area 2πa g and the hollow the area 2πb hB. The body is the segment of A of height g minus the cap of B of height hB:
$$V = \frac{\pi g^2 (3a - g)}{3} - \frac{\pi h_B^2 (3b - h_B)}{3}$$$$A = 2\pi a g + 2\pi b h_B$$When the removed lens is thin, or when it is almost all of A, the two terms of V are nearly equal and a direct subtraction loses digits. Write g = hB + e with e = a + c − b (g runs from the far pole of A at −a to the plane, hB from the nearest point of B at c − b to the plane, and these two points lie a + c − b apart). Expanding (hB + e)²(3a − hB − e) and taking away hB²(3b − hB) leaves a sum in which nothing large cancels:
$$V = \frac{\pi}{3}\left[h_B^2 \left(2(a - b) - c\right) + e\,(2h_B + e)(3a - h_B - e)\right]$$The page forms kA, hB, g, e, the plane position x and this bracket from the typed digits with 40-digit decimal arithmetic, so every result keeps its digits over the whole input range. The cut circle has the radius √(kA g). When B is larger than A the plane can lie behind the centre of A (x negative).
Worked example
With a = 4, b = 3 and c = 5 the cut plane lies 3.2 from the centre of A, the cut circle has the radius 2.4 and the hollow is 1.2 deep. The volume is about 248.814138 cubic units and the surface area about 203.575204 square units.
FAQ
Why is the surface just the zone plus the cap?
Every point of sphere A on the far side of the cut plane lies outside B and stays; every point on the near side lies inside B and goes. Likewise the part of sphere B on the near side of the plane lies inside A and becomes the wall of the hollow. Nothing else bounds the body.
What if one ball lies inside the other?
If B lies inside A, removing it leaves a ball with a closed cavity, and if A lies inside B nothing is left. Neither is a sphere difference of this kind, so the page asks for c larger than the difference of the radii.
Does the unit change the numbers?
No. Geometry does not depend on the unit, so the unit only labels the results.
How accurate are the results?
Results are accurate to at least 9 significant digits for ordinary inputs. When a result depends on the small difference of two nearly equal entries (closer than one part in a million), fewer digits are reliable.
Accuracy and input range
Results are accurate to at least 9 significant digits for ordinary inputs. When a result depends on the small difference of two nearly equal entries (closer than one part in a million), fewer digits are reliable.
Enter each length from 0.000001 to 1,000,000,000. Anything outside is refused with a message naming the range.
References
Archimedes, On the Sphere and Cylinder, Book I (the zone of a sphere has the area 2πRh); T. L. Heath (ed.), The Works of Archimedes, Cambridge University Press, 1897
D. Zwillinger (ed.), CRC Standard Mathematical Tables and Formulae, 33rd ed., CRC Press, 2018, ch. 4 (solids of revolution, spherical and conical solids)