Library · Geometric Probability · Chapter 33
Expected distance on a segment
Problem 33.1
Let be two points chosen independently and uniformly on the unit segment . What is the expected distance ?
Solution. By symmetry, condition on (the event has probability ). In this case, . Compute directly: By symmetry between and , the conditional expectation is the same given , so
Alternatively, think of the three pieces of a stick snapped at two uniform points: they have lengths , where and . The middle piece has length , and by symmetry among the three order statistics each piece has expected length . The answer is therefore just the equality of the three expected part-lengths.
This constant turns up in many places in geometric probability. We have already seen it in Chapter 32 as a factor of , and the higher moments play a role in other classical computations.
import numpy as np
x, y = np.random.rand(2, 10**7)
print(f"sim: {np.abs(x-y).mean():.5f} exact: {1/3:.5f}")
# sim: 0.33333 exact: 0.33333