# Sphere minus cylinder

Consider a sphere of radius R and a cylinder, whose axis passes through the sphere's centre, of radius r < R; in describing them, I'll take the axis direction as vertical. The cylinder cuts the sphere into two parts, the central core (think of an apple) and an outer ring. The core is 2.R tall, of course; while, with h = √(R.R −r.r), the ring's height is 2.h. Now let's consider the volume of the outer ring, first by brute-force integration:

integral(: dx^dy^dz ← [x, y, z]; x.x +y.y > r.r, x.x +y.y +z.z ≤ R.R :)
= integral(: s.ds^da^dz ← [a, s, z]; s > r, s.s +z.z ≤ R.R, 0≤a<2.π :)

in which x = s.cos(a), y = s.sin(a); and the integrand is left with no a-dependence, so we get

= 2.π.integral(: s.ds^dz ← [s, z]; s > r, s.s +z.z ≤ R.R :)

For each z, compute the integral over s's variation:

= 2.π.integral(: integral(: s.ds ← s; r < s ≤ √(R.R −z.z) :).dz ←z; −h < z < h :)

That inner integral is just the change in s.s/2 between its bounds

= π.integral(: R.R −z.z −r.r ←z; −h < z < h :)

in which R.R −r.r = h.h is a constant; and the integral of z.z is just the change in z.z.z/3

= π.(2.h.(R.R −r.r) −2.h.h.h/3)
= 2.π.h.h.h.(1 −1/3)
= 4.π.h.h.h/3

with the surprising result that the volume doesn't depend on R and r other than via h.

This leads to a question, sometimes asked: What's the volume of the outer part, given only that its height is 2.h ? for some specified h. This implicitly claims that the answer doesn't depend on R and r, from which we can infer that the answer must be the one you'd get if r were 0, requiring R = h, so 4.π.h.h.h/3 has to be the answer. The tricky part is deciding that the answer does, indeed, only depend on R and r via h.

So let's go back to what that brute-force integral is saying: at each z value, the s-integral is π.(h.h −z.z), which is exactly the area of the h-radius sphere's cross-section in the horizontal plane at the given z; i.e. our ring's cross-sectional area at each height is the same as that of the h-sphere. So picture the ring's cross-section at a given height; it's a difference between two circles, the inner one of radius r from the cylinder and an outer one, from the sphere, whose radius depends on the z value; the square of that outer radius is R.R −z.z and π times this is the area of the outer circle; subtracting the inner circle's π.r.r, we're left with π.(h.h −z.z), exactly as in the cross-section of the h-sphere.

Written by Eddy.