Thought Toys · Chance & inference · Exhibit 13

Buffon's needle

Here is the strangest way to measure π ever devised. Rule a floor with evenly spaced lines. Toss matchsticks onto it at random. Count what fraction land touching a line. Flip that fraction, scale it, and out falls 3.14159… — the circle constant, conjured from scattered sticks, with not a single circle anywhere in sight.

Sticks crossing a line glow amber; the rest stay grey

π ≈

Drop some needles to begin.

The running estimate closing in on π as the sticks pile up

What you're seeing

Each stick lands at a random spot and a random tilt. Whether it crosses a line depends only on two things: how far its centre sits from the nearest line, and how steeply it's angled. A stick lying flat between two lines almost never reaches one; a stick standing more upright easily bridges the gap. Average over every possible position and angle and the chance of a crossing works out to a clean formula — and the only odd ingredient in it is π, which sneaks in because we averaged over all those angles (and angles live on circles).

So you can run the formula backwards. You don't know π, but you can count: drop a pile of sticks, tally the crossings, and the crossing fraction is your measured stand-in for that probability. Rearranged, it spits out an estimate of π. Press Rain and watch the number below twitch wildly at first — a handful of sticks is noisy — then steady and crawl toward 3.14159 as the count climbs into the thousands. The lower chart is that convergence: jittery on the left, hugging the π line on the right.

It's a perfect little parable of Monte Carlo estimation: when a quantity is hard to calculate but easy to sample, you can just take random draws and let the law of large numbers grind out the answer. People estimated π this way by hand, throwing needles for hours, long before computers. Slide the needle length and the crossing rate changes — but the formula corrects for it, and π comes out all the same.

The rule, exactly. Lines spaced D apart; needles of length L ≤ D. A needle crosses a line exactly when the distance from its centre to the nearest line is at most (L/2)·|sin θ| for its angle θ. Averaging over a uniform centre and a uniform angle gives crossing probability P = 2L ⁄ (πD). Measure that probability as crossings ⁄ throws and solve for π: π ≈ 2 · L · (throws) ⁄ (D · crossings). Error shrinks like 1/√(throws). (Checked offline before shipping: two-million-throw simulations land on 3.141–3.142 across several L/D ratios.) Counter-example, verified in node: the crossing chance is 2L/(πD), not the tempting L/D — at L=1, D=2 it is 0.318 (measured 0.315 over 2M throws), not 0.5.

Also in Chance & inference: The central limit theorem →

All 16 in Chance & inference
  1. 05The Galton board
  2. 06The Monty Hall problem
  3. 09Bayes' theorem
  4. 13Buffon's needle — you are here
  5. 14The central limit theorem
  6. 28Simpson's paradox
  7. 30Markov chains
  8. 31Averages that never settle
  9. 35The birthday paradox
  10. 38The drunkard's walk
  11. 39Zipf's law
  12. 40Benford's law
  13. 42The coupon collector's problem
  14. 48The wisdom of crowds
  15. 52Genetic drift
  16. 63The gaps are chaos. The count is law.

← Back to the cabinet  ·  Thought Toys — Exhibit 13.