A geometry problem that hides pi
In 1733 Georges-Louis Leclerc, Comte de Buffon, posed a deceptively simple question: drop a needle of length L at random onto a floor ruled with parallel lines spaced d apart (with L ≤ d), and ask for the probability the needle crosses one of the lines. The surprising answer involves π, purely because the problem mixes a linear randomness (where the needle's centre lands between two lines) with an angular one (what direction the needle points), and integrating over an angle is where π naturally enters.
Deriving the crossing probability
Let x be the distance from the needle's midpoint to the nearest line (uniformly distributed between 0 and d/2) and θ be the acute angle the needle makes with the lines (uniformly distributed between 0 and π/2, or equivalently 0 to π by symmetry). The needle crosses a line exactly when the vertical reach of its half-length, (L/2)·sin(θ), is at least as large as x. Averaging that crossing condition over all equally likely (x, θ) pairs — integrating sin(θ) over the angle and dividing by the range of x — gives a clean closed form:
P(crossing) = (2 * L) / (pi * d) // for L <= d pi_estimate = (2 * L * N) / (d * crossings) // solve for pi using observed crossings
Rearranging that probability formula to solve for π, and replacing the true probability with the observed fraction of crossings out of N total drops, gives an experimental estimate of π built entirely from a physical random process — no digits of π were assumed anywhere in the setup, they emerge purely from geometry and randomness.
Why this is a Monte Carlo method, decades before the name existed
Buffon's needle is now recognised as one of the earliest known Monte Carlo methods — using repeated random sampling to estimate a deterministic quantity that would otherwise require exact geometric or analytic computation. It predates the term "Monte Carlo" (coined in the 1940s at Los Alamos) by roughly two centuries, but the core idea is identical to modern Monte Carlo integration: express an unknown constant as the expected value of some random experiment, then approximate that expectation by averaging a large number of independent trials.
The law of large numbers, and why the estimate wobbles then settles
With only a handful of needle drops, the observed crossing fraction can be wildly off from the true probability 2L/(πd) purely by chance — few trials means large sampling variance. The law of large numbers guarantees that as the number of drops N grows, the observed fraction converges to the true probability with probability one, so the derived π estimate converges to the real value of π. But convergence is slow: the standard error of a Monte Carlo estimate like this one shrinks only as 1/√N, so quadrupling the number of drops only halves the typical error — to gain one more reliable decimal digit of π this way requires roughly a hundred-fold increase in the number of needles dropped, which is why Buffon's needle is a wonderful illustration of Monte Carlo convergence but a terrible way to actually compute π to many digits.
The needle length matters too
The formula P = 2L/(πd) assumes L ≤ d, so the needle can cross at most one line per drop; setting L equal to d maximises the crossing probability for that regime and gives the most "information" — the highest expected number of crossings — per drop, which in turn minimises the relative sampling error for a fixed number of trials. A much shorter needle relative to the line spacing crosses only rarely, wasting most drops on non-crossings and requiring far more trials to pin down π to the same precision; a needle longer than d (Laplace's later extension) can cross more than one line and needs a more elaborate probability formula altogether.
A demonstration, not a computation
No one has ever used Buffon's needle to set a record for computing digits of π — that role belongs to fast-converging algorithms unrelated to random sampling. Its enduring appeal is pedagogical: it is a visceral, physical demonstration that a purely geometric probability can encode π, and that random sampling — however slow to converge — really can extract a deterministic mathematical constant from nothing but repeated chance events, which is precisely the intuition underlying every modern Monte Carlo simulation used in finance, physics and computer graphics today.
Frequently asked questions
Why does dropping needles reveal the value of pi?
The probability that a randomly dropped needle crosses one of the ruled lines works out to 2L/(pi*d), a formula derived by integrating over both the needle's random position and its random angle. Since angles are measured in a full circle of 2*pi radians, pi enters naturally through that integration, and rearranging the formula lets you solve for pi using the observed crossing fraction.
How many drops are needed to estimate pi accurately?
Far more than intuition suggests, because the standard error of this kind of Monte Carlo estimate only shrinks as the square root of the number of trials. Getting one additional reliable digit of precision typically requires on the order of a hundred times as many needle drops as the previous digit did.
Is Buffon's needle actually used to compute pi in practice?
No — it's far too slow to converge compared to modern algorithms for computing digits of pi. Its real value is as one of the earliest known examples of a Monte Carlo method, demonstrating that random sampling can extract a deterministic constant from a purely geometric probability.
Try it live
Everything above runs in your browser — open Buffon's Needle and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.
▶ Open Buffon's Needle simulation