Probability
Buffon's Needle: Estimating π by Dropping Needles
Buffon's Needle is the oldest problem in geometric probability: drop a needle of length ℓ onto a floor ruled with parallel lines spaced d apart (ℓ ≤ d), and the probability it crosses a line is exactly P = 2ℓ/(πd). Because π sits in that formula, you can run the experiment backwards — count crossings among many random drops and solve for π. It is a startling fact that a constant of pure geometry falls out of nothing but randomness, and it launched the entire field of Monte Carlo estimation.- Posed byGeorges-Louis Leclerc, Comte de Buffon (1733; published 1777)
- Short-needle formulaP = 2ℓ/(πd), valid for ℓ ≤ d
- Estimator for ππ̂ = 2ℓN / (dC), C = crossings in N drops
- Special case ℓ = dP = 2/π ≈ 0.6366
- ConvergenceError shrinks like O(1/√N) — slow
- Field foundedGeometric probability / integral geometry
Watch the 60-second explainer
A condensed visual walkthrough — narrated, captioned, under a minute.
The setup and the exact formula
Rule a floor with infinitely many parallel lines, evenly spaced a distance d apart. Take a thin needle of length ℓ with ℓ ≤ d (the short-needle case) and drop it so that its center lands at a uniformly random position and its orientation is a uniformly random angle. The event of interest is that the needle crosses (touches or intersects) one of the lines.
The exact result Buffon derived is:
P(cross) = 2ℓ / (πd).
Two random variables fully describe a drop. Let y ∈ [0, d/2] be the distance from the needle's center to the nearest line, taken uniform on [0, d/2] by symmetry, and let θ ∈ [0, π/2] be the acute angle between the needle and the lines, uniform on [0, π/2]. The needle reaches the nearest line exactly when its half-projection perpendicular to the lines exceeds y, i.e. when
y ≤ (ℓ/2)·sin θ.
The crossing probability is the fraction of the (y, θ) rectangle satisfying that inequality — which is what the next section computes.
Why it's true: an integral over all drops
Both variables are independent and uniform, so the joint density is constant: 1/(d/2) · 1/(π/2) = 4/(πd) on the rectangle [0, d/2] × [0, π/2]. The needle crosses iff y ≤ (ℓ/2) sin θ, so we integrate that density over the favorable region:
P = ∫₀^{π/2} ∫₀^{(ℓ/2) sin θ} (4/(πd)) dy dθ = (4/(πd)) ∫₀^{π/2} (ℓ/2) sin θ dθ.
The inner integral just returns the height (ℓ/2) sin θ. Now ∫₀^{π/2} sin θ dθ = [−cos θ]₀^{π/2} = 0 − (−1) = 1, so
P = (4/(πd)) · (ℓ/2) · 1 = 2ℓ/(πd). ∎
The intuition: a needle at angle θ has a vertical shadow of length ℓ·sin θ. It crosses a line precisely when a line falls inside that shadow, which happens with probability (ℓ sin θ)/d for any fixed θ (as long as that's ≤ 1). Averaging over all angles, you need the mean of sin θ. That average is exactly 2/π — the mean value of sin over a quarter turn is (1/(π/2))∫₀^{π/2} sin θ dθ = 2/π. Multiply the two pieces, ℓ/d and 2/π, and you get 2ℓ/(πd). The π appears because it is baked into how much a rotating segment sticks out on average.
A worked example: estimating π from 1000 drops
Set ℓ = d (needle length equals line spacing), the case the animation uses. Then the crossing probability is P = 2ℓ/(πd) = 2/π ≈ 0.63662. Rearranged, this gives the estimator π̂ = 2/P, and empirically we replace P by C/N (crossings over drops):
π̂ = 2N / C.
Suppose we drop N = 1000 needles and observe C = 631 crossings. Then:
- Observed crossing rate: C/N = 631/1000 = 0.631.
- Estimate: π̂ = 2·1000 / 631 = 2000/631 ≈ 3.1696.
- Error: |3.1696 − 3.14159| ≈ 0.028, about 0.9%.
Is 631 a plausible count? The expected number of crossings is N·P = 1000·0.63662 ≈ 636.6, with standard deviation √(N·P(1−P)) = √(1000·0.6366·0.3634) ≈ √231.3 ≈ 15.2. So 631 sits well within one standard deviation of the mean — a completely ordinary outcome. If instead you saw C = 637 (right on the mean), you'd get π̂ = 2000/637 ≈ 3.1397, off by only 0.002. The estimate wobbles because C is random; that wobble is the whole story of how fast this method converges.
How fast does it converge — and why it's slow
The count C is Binomial(N, P), so the estimator π̂ = 2N/C inherits its noise. By the delta method the standard error of π̂ scales like:
SE(π̂) ≈ π·√((1 − P)/(N·P)) = π·√((π − 2)/(2N)).
For ℓ = d that constant is π·√((π−2)/2) ≈ π·√0.5708 ≈ 2.37. So the typical error after N drops is about 2.37/√N. To get one extra correct decimal digit you must shrink the error tenfold, which means multiplying N by one hundred. Concretely:
- N = 100 → error ≈ 0.24
- N = 10⁴ → error ≈ 0.024 (≈ 2 digits)
- N = 10⁶ → error ≈ 0.0024 (≈ 3 digits)
- N = 10⁸ → error ≈ 0.00024 (≈ 4 digits)
This O(1/√N) rate is the signature of every Monte Carlo method, and it is brutally slow compared to a good series. Lazzarini's famous 1901 'experiment' reported π ≈ 3.1415929 from 3408 tosses — suspiciously accurate to 6 digits, which N = 3408 cannot honestly deliver (the honest error is ~0.04). He almost certainly stopped at a toss count engineered so that 355/113 (a superb rational approximation to π) popped out. It is a cautionary tale about stopping rules, not a triumph of the method.
The long-needle case and the Buffon–Laplace grid
When ℓ > d the needle can cross several lines at once, and the clean formula changes. Now define m = ℓ/d > 1. Integrating the same geometry (accounting for angles where the projection exceeds d) gives the general expected number of crossings:
E[crossings] = (2/π)·(ℓ/d) = 2m/π,
which is remarkably clean and holds for all ℓ: the expected number of line-crossings per drop is simply 2ℓ/(πd). (For ℓ ≤ d this expectation equals the crossing probability because you can only cross 0 or 1 line.) That means you can estimate π honestly even with long needles by counting total crossings, not just whether a crossing occurred — and this is the statistically efficient thing to do.
Buffon–Laplace variant: replace the parallel lines with a rectangular grid of spacing a × b. A short needle (ℓ ≤ min(a,b)) now has crossing probability P = [2ℓ(a + b) − ℓ²] / (πab). Two families of lines create more crossings per drop, so the estimator has lower variance for the same N — a genuinely better π-machine than single lines.
Why it matters and what to watch out for
Buffon's needle (posed 1733, published 1777) is the founding problem of geometric probability and a direct ancestor of integral geometry — the Cauchy–Crofton formula, which recovers the length of any curve by counting how often random lines cross it, is Buffon's argument generalized. It is also the historical seed of the Monte Carlo method: using random sampling to estimate a deterministic quantity you cannot compute directly.
Common pitfalls to avoid:
- Using the wrong formula for long needles. P = 2ℓ/(πd) exceeds 1 once ℓ > πd/2 ≈ 1.57d — a probability can't do that. Beyond ℓ = d you must use the expected-crossings form, not the naive one.
- Non-uniform dropping. The derivation demands θ uniform on angles and center uniform in position. A biased hand, a needle that bounces, or clustered throws breaks the assumption and biases π̂.
- Cherry-picking the stopping count (the Lazzarini trap). Deciding to stop when the estimate looks good manufactures accuracy that the sample size cannot support.
- Expecting speed. This is a beautiful demonstration, not a practical π-computer — even a laptop running 10⁹ virtual drops only reaches ~4 correct digits, while the Leibniz series or Chudnovsky formula crush it.
| Method | Setup | π estimate | Efficiency |
|---|---|---|---|
| Buffon's needle (ℓ = d) | Drop needles on ruled lines, count crossings C | π ≈ 2N/C | Very slow; ~10⁶ drops for ~2–3 digits |
| Buffon–Laplace grid | Drop on a rectangular grid, count crossings of either axis | Higher crossing rate → less variance | Better than single lines, still O(1/√N) |
| Circle-in-square darts | Throw points in [0,1]², count fraction inside quarter-circle | π ≈ 4·(inside/total) | O(1/√N), simple, no needle geometry |
| Series (e.g. Leibniz) | Sum 4(1 − 1/3 + 1/5 − …) | Deterministic partial sums | O(1/N) — beats all random methods |
Frequently asked questions
Why does π appear at all — there are no circles in the setup?
Because the needle rotates. A segment at angle θ casts a vertical shadow of length ℓ·sin θ, and averaging sin θ over a random orientation brings in π: the mean of sin over a quarter turn is (2/π). The circle is hidden in the rotation, not in the floor. Any quantity built from averaging a trig function of a uniform random angle will carry a π.
What exactly is the estimator for π?
For a short needle, π̂ = 2ℓN / (dC), where N is the number of drops and C the number that cross a line. In the clean case ℓ = d this is just π̂ = 2N/C. You are solving P = 2ℓ/(πd) for π after replacing the true probability P with the observed frequency C/N.
How many drops do I need for a given accuracy?
The typical error is about 2.37/√N for ℓ = d. So ~10⁴ drops gives roughly 2 correct digits, ~10⁶ gives ~3, and each additional digit costs a 100× increase in N. It is an honest O(1/√N) Monte Carlo rate — reliable but slow.
What happens if the needle is longer than the line spacing (ℓ > d)?
The simple probability formula breaks (it would give a value above 1). Instead, count the total number of line-crossings per drop; the expected number is always 2ℓ/(πd) for any ℓ. Estimating π from total crossings works for long needles and is actually lower-variance.
Was Lazzarini's 1901 result of π ≈ 3.1415929 legitimate?
Not really. With only 3408 tosses the honest expected error is around 0.04, so six-digit accuracy is statistically impossible by luck. He appears to have chosen a toss count that makes the estimate collapse onto 355/113, a known excellent rational approximation to π. It is a classic example of a rigged stopping rule.
Is Buffon's needle a good way to actually compute π?
No — it is a conceptual gem, not a practical tool. Its O(1/√N) convergence is far slower than deterministic series like Leibniz (O(1/N)) or Chudnovsky (which adds ~14 digits per term). Its real importance is historical and pedagogical: it founded geometric probability and prefigured the Monte Carlo method.