Buffon’s needle
In 1777, Georges-Louis Leclerc, Comte de Buffon asked: if you drop a needle of length onto a floor with parallel lines spaced apart (), what is the probability the needle crosses a line?
The answer connects a purely geometric experiment to π:
Rearranging, you get a Monte Carlo estimator for π:
where N is the total number of needles dropped and C is the number that crossed a line.
π ≈ 3.07692 error: 0.06467
325 crossings / 500 needles
What to notice
- The estimate converges slowly. After 500 needles the estimate might still be off by 0.02–0.1. Monte Carlo estimators for π converge at rate — you need 100× more needles to gain one decimal place.
- Red crosses, blue misses. A needle crosses a line when its centre is within of the nearest line, where θ is the needle’s angle.
- Resample to see a new realisation and how much the estimate varies from run to run.
Why π appears
The crossing probability comes from integrating over all possible needle positions and angles. The integral of over evaluates to 2, and dividing by the normalising constant is what injects π into the formula. The geometry forces trigonometry, and trigonometry carries π.