Library · Geometric Probability · Chapter 31
Expected squared distance in a disc
Problem 31.1
Let be points chosen independently and uniformly in the closed disc of radius . What is the expected squared distance ?
Solution. Treat as two-dimensional vectors. Expanding the squared distance,
Take expectations. By independence, . By the rotational symmetry of the disc, (each component has zero mean). Hence where is a single uniform random point in the disc.
Compute in polar coordinates with density : Therefore
The appeal of this result is its total absence of elliptic integrals. The first moment (“disc line picking”) is much harder to compute; it reduces to an elliptic integral via the law of cosines. The squared distance admits a much cleaner analysis thanks to the bilinearity of the inner product and the vanishing of the mean vector.
import numpy as np
# Uniform on unit disc via (sqrt(u), theta) polar
r = np.sqrt(np.random.rand(2, 10**7))
theta = np.random.rand(2, 10**7) * 2*np.pi
x, y = r*np.cos(theta), r*np.sin(theta)
d2 = (x[0]-x[1])**2 + (y[0]-y[1])**2
print(f"sim: {d2.mean():.5f} exact: 1.0")
# sim: 1.00012 exact: 1.0