Numbers & Logic

Estimating Pi by Dropping Needles

Drop a needle on ruled floorboards often enough and π appears — unless your luck is a little too perfect.

Picture a French aristocrat, in 1777, asking his readers to throw needles at the floor. Georges-Louis Leclerc, Comte de Buffon, was one of the most famous men of science in Europe — his monumental Histoire naturelle ran to 36 volumes in his lifetime and made him the Enlightenment's great naturalist — but he had begun his career in mathematics and never quite left it. In his Essai d'arithmétique morale, published that year, he posed what became the most charming problem in probability: rule a floor with parallel lines a fixed distance apart, toss a needle onto it at random, and ask how often the needle falls across a line.

Buffon had in fact aired an early version at the Royal Academy of Sciences in Paris back in 1733, alongside an analysis of franc-carreau, a gambling game in which a coin is thrown onto a tiled floor. But the needle is the version posterity kept, because the answer contains a surprise. For a needle no longer than the gap between the lines, the probability of a crossing is 2L divided by πd, where L is the needle's length and d the spacing. Throw a needle exactly as long as the gap is wide and it crosses a line with probability 2/π — about 63.7 per cent. The circle constant had walked, uninvited, into a question containing no circles at all.

Turn the formula round and it becomes an experiment. Drop a needle thousands of times, count the crossings, and simple arithmetic hands you an estimate of π made of nothing but floorboards and patience. Pierre-Simon Laplace, who extended the problem to a grid of squares — the version now called Buffon–Laplace — was among the first to point out this use, and in doing so sketched, a century and a half early, the idea we now call the Monte Carlo method: when a quantity is too hard to calculate, gamble your way towards it.

The suspiciously lucky Italian

Which brings us to 1901, and a cautionary tale. Mario Lazzarini, an Italian mathematician, reported a needle experiment of heroic scale: 3,408 tosses of a needle 2.5 centimetres long over lines 3 centimetres apart, yielding 1,808 crossings and an estimate of π of 3.1415929 — correct to six decimal places. It is a result that should raise every eyebrow in the room. The method's accuracy improves only with the square root of the number of throws, so after a few thousand tosses an honest experimenter expects errors in the second or third decimal place, not the seventh.

The design gives the game away. Lazzarini's figure is exactly 355/113 — the famous fraction known to the Chinese astronomer Zu Chongzhi in the fifth century, which matches π to six decimals and cannot be beaten by any fraction with a denominator below about 16,600. Because Lazzarini chose a needle five-sixths the width of his line spacing and toss counts in multiples of 213, his running estimate would land exactly on 355/113 whenever the crossing count hit the right value; one need only stop there. Whether he fabricated the data or merely halted at a flattering instant, statisticians who have re-examined the report — most famously Lee Badger in a 1994 study — judge the result far too good to be true. It survives in textbooks as a parable about experiments that confirm what their designers wanted.

From parlour game to bomb design

The needle's respectable descendants arrived in the 1940s. Stanisław Ulam, convalescing from an illness in 1946, passed the time playing Canfield solitaire and wondered whether the odds of winning could be found not by exhausting the combinatorics but by simply playing many hands and counting. He took the idea to John von Neumann, who saw at once that the new electronic computer ENIAC could apply it to a deadly serious problem: tracing the paths of neutrons through fissile material for the weapons work at Los Alamos. Their colleague Nicholas Metropolis supplied the code name — Monte Carlo, after the casino where Ulam's uncle used to gamble with borrowed family money — and the name stuck.

Today Monte Carlo methods price financial derivatives, forecast weather and epidemics, render the lighting in animated films and simulate particle collisions — anywhere an exact calculation is hopeless but random sampling is cheap. Every one of those simulations is Buffon's needle in modern dress: replace the integral you cannot do with the chance you can measure. Buffon set out to measure luck, and ended up giving posterity a way of making luck do the measuring.

Quiz nuggets

  • Buffon posed the needle problem in his Essai d'arithmétique morale, published in 1777.
  • A needle exactly as long as the gap between the lines crosses one with probability 2/π, about 63.7 per cent.
  • Mario Lazzarini's 1901 report of 3,408 needle tosses gave π as 3.1415929 — exactly the fraction 355/113 — and is widely judged too good to be true.
  • The fraction 355/113, matching π to six decimal places, was known to Zu Chongzhi in fifth-century China.
  • The Monte Carlo method, conceived by Stanisław Ulam over solitaire in 1946, was named by Nicholas Metropolis after the casino where Ulam's uncle gambled.

Written from public sources and not individually checked — worth confirming before you stake a pint on it.