Library · Geometric Probability · Chapter 57
Buffon’s noodle
Problem 57.1
A plane is ruled with parallel lines at equal spacing . Instead of a straight needle, a piece of flexible wire in the shape of an arbitrary rectifiable curve of length is dropped at random on the plane. What is the expected number of crossings between the curve and the ruled lines?
Solution. The trick is linearity of expectation. Approximate the curve by a polygonal path of short straight segments. For any straight line segment of length , we have from Chapter 53 that the expected number of crossings is regardless of whether is smaller or larger than (for , crossings are or ; for they can exceed , but the same integral formula holds because Buffon’s calculation integrates the number of crossings, not the indicator of “at least one”).
By linearity of expectation, the expected number of crossings of a polygon with total length is Taking the limit as the polygonal approximation tends to the curve (a standard continuity argument for rectifiable curves),
The result is shape-invariant: two pieces of wire of the same length, bent into different shapes, have the same expected number of crossings. A flexible noodle of total length has expected two crossings per toss, whatever its shape — a fact sometimes used as an amusing Monte Carlo estimator of .
import numpy as np
# Long straight needle (L > d): E[crossings] = 2L/(pi d) holds for any L.
L, d, N = 2.5, 1.0, 10**6
theta = np.random.rand(N) * np.pi
y = np.random.rand(N) * d
y_top = y + L/2 * np.sin(theta)
y_bot = y - L/2 * np.sin(theta)
crossings = np.abs(np.floor(y_top/d) - np.floor(y_bot/d))
print(f"sim: {crossings.mean():.5f} exact: {2*L/(np.pi*d):.5f}")
# sim: 1.59045 exact: 1.59155