What is the expected distance between two random points inside a sphere?
geometry/points.in.sphere
Problem
What is the expected distance between two random points inside a sphere? Assume the points are uniformly and independently distributed.
Show solution
Use spherical polar coordinates, and w.l.o.g. choose the polar axis
through one of the points. Now the distance between the two points is
sqrt ( r1^2 + r2^2 - 2 r1 r2 cos(theta))
and cos(theta) is (conveniently) uniformly distributed between -1 and
+1, while r1 and r2 have densities 3 r1^2 d(r1) and 3 r2^2 d(r2). Split
the total integral into two (equal) parts with r1 < r2 and r1 > r2, and
it all comes down to integrating polynomials.
More generally, the expectation of the n'th power of the distance
between the two points is
2^n . 72 / ((n+3)(n+4)(n+6))
So the various means are:
the (arithmetic) mean distance is 36/35 = 1.028571...
the root mean square distance is sqrt(6/5) = 1.095445...
the geometric mean distance is 2exp(-3/4) = 0.944733...
the harmonic mean distance is 5/6 = 0.833333...
the inverse root mean inverse square distance is
2/3 = 0.666666...