Library · Geometric Probability · Chapter 2
The longest of three pieces
Problem 2.1
A unit stick is snapped at two independent uniform random points. What is the probability that the longest of the three resulting pieces has length greater than ?
Solution. Let the break points be at positions , independent uniform. The three pieces have lengths , , and . The longest piece exceeds iff some piece exceeds : The three events are mutually exclusive: if then both , forcing and ; similarly if then . So we may add the three probabilities directly.
Each event corresponds to a region of the unit square:
, area ,
, area ,
is the union of two corner triangles (upper-left and lower-right), each of area , total area .
Summing,
import numpy as np
x, y = np.random.rand(2, 10**7)
pieces = np.stack([np.minimum(x,y), np.abs(x-y), 1-np.maximum(x,y)])
p = (pieces.max(axis=0) > 0.5).mean()
print(f"sim: {p:.5f} exact: 0.75")
# sim: 0.74991 exact: 0.75