Buffon’s Needle illustration

Buffon’s Needle

Buffon’s needle is the classic 18th-century experiment that estimates π by throwing needles onto a floor of equally spaced parallel lines. The chance a needle crosses a line depends on π, so counting crossings gives an estimate back: with needle length L and line spacing t (L ≤ t), the crossing probability is 2L/(πt), and rearranging turns the observed crossing rate into an estimate of π. This simulator rains needles down, colours the ones that cross a line, and plots the running estimate converging on 3.14159 as the throws pile up.

Runs 100% in your browser — simulations are computed locally on your device.

Notes

  • A needle of length L on lines spaced t apart crosses with probability 2L/(πt) when L ≤ t.
  • Inverting that gives π ≈ 2L·N / (t·C) for N throws and C crossings — a Monte Carlo estimate of π.
  • Convergence is slow: the error shrinks like 1/√N, so ten times more needles only cut the error by about a third.
  • Runs 100% in your browser — simulations are computed locally on your device.