Library · Geometric Probability · Chapter 28
Two random unit vectors on a sphere
Problem 28.1
Let and be two independent uniformly-distributed unit vectors on the sphere . What is the expected value of ?
Solution. By rotational symmetry, we may condition on and assume, without loss of generality, that . Then , the third coordinate of .
For uniformly distributed on , its third coordinate has a well-known distribution: is uniform on . This is the content of Archimedes’s hat-box theorem — the sphere’s “height” coordinate has uniform density with respect to Lebesgue measure on the interval. (Equivalently: the vertical strip has the same area for every , namely .)
With , the expected absolute value is Therefore
The result is a clean one-line consequence of Archimedes’s hat-box theorem, with no heavy calculation. In contrast, the two-dimensional analogue — iid uniform on the unit circle — gives where angle between them is uniform on . The appearance of in 2D versus the rational in 3D is a consequence of the different angular Jacobian on the circle () versus on the sphere (hat-box: uniform on height).
import numpy as np
# Uniform on S^2 via normalised Gaussian
u = np.random.randn(3, 10**7); u /= np.linalg.norm(u, axis=0)
v = np.random.randn(3, 10**7); v /= np.linalg.norm(v, axis=0)
dots = np.abs((u*v).sum(axis=0))
print(f"sim: {dots.mean():.5f} exact: 0.5")
# sim: 0.49989 exact: 0.5