Buffon's Needle
Drop needles on a floor of planks and estimate π from the share that cross a seam.
- Crosses a line
- Misses
- Line between planks
In theory, a needle crosses a line with chance 63.7%.
Needles land at random on a floor of planks; the ones that cross a seam are drawn red and the rest dark gray. Counting crossings estimates π; tap the floor to drop a handful more, an event in time that Restart and share links leave out, or switch to raindrops to estimate it from a circle in a square.
How is Buffon's Needle working for you?
About Buffon's Needle
- Posed
- By Buffon in 1733, solved in 1777
- Chance of crossing
- 2l ÷ (π t) for a needle no longer than the gap
- Accuracy
- Error shrinks like 1 ÷ √(number of drops)
- Lazzarini's claim
- 355/113 from 3,408 drops (1901)
In 1733 Georges-Louis Leclerc, Comte de Buffon, asked a question about a floor of parallel planks: if you drop a needle at random, what is the chance it lands across a seam? He published the answer in 1777. A needle exactly as long as the gap crosses a seam with chance 2/π, about 63.7%, so a pile of dropped needles measures π. This floor drops needles at random spots and angles, draws the ones that cross a seam red and the rest dark gray, and estimates π as 2 × (total needle length) ÷ (gap × crossings), live, with the correct digits in green. Pierre-Simon Laplace pointed out in 1812 that the experiment could be used to calculate π, which makes it one of the oldest Monte Carlo methods, long before Nicholas Metropolis and Stanislaw Ulam named the approach in 1949.
Needles longer than the gap can cross two or more seams, and bent noodles can cross the same seam several times, yet the average number of crossings is still 2 × length ÷ (π × gap) whatever the shape, a result of Joseph-Émile Barbier that J. F. Ramaley explained as Buffon's noodle problem. Counting every crossing therefore estimates π with needles of any length and with noodles too. Raindrops mode estimates π another way: drops land evenly over a square, and the share that falls inside the circle drawn in it is π/4.
The Lazzarini 1901 preset repeats a famous claim. Mario Lazzarini reported dropping a needle 5/6 of the gap long 3,408 times and getting 355/113 = 3.1415929, π to six decimal places; Lee Badger showed in 1994 how unlikely that is unless you choose when to stop. Run it a few times and your 3,408 drops will usually be about 0.05 away. The error shrinks only like one over the square root of the number of drops, so each extra correct digit takes about 100 times more needles. Export the estimate as it grows as a CSV file, or record a video or GIF.
How to use Buffon's Needle
- Press Play. Needles land on the floor at random positions and angles. The ones that cross a seam are drawn red and the rest dark gray, and the banner shows the estimate of π with its correct digits in green.
- Throw a handful. Tap the floor to drop ten more needles at once; they land at random spots, so the estimate stays fair. A tap is an event in time that Restart and share links leave out.
- Change the needles. Set Needle length as a multiple of the gap, from 0.1 to 2, and the number of Floorboards. Long needles can cross two seams at once.
- Try noodles and raindrops. Noodles drops bent needles, which still cross the same number of seams on average. Raindrops estimates π from the share of drops inside a circle.
- Speed it up. Raise Speed up to 2,000 drops per second to watch the estimate settle, and use Stop after to end at a fixed number of drops, such as Lazzarini's 3,408. Each run that stops adds a row to the Runs table with its estimate of π and the digits it gets right; Reset clears the table.
- Export. Save a PNG, a video or GIF, or the estimate after each batch of drops and the Runs table as CSV files. When Stop after is set, Record full run drops again from the start and records until it stops; otherwise Record 30 s from the start records the first 30 seconds.
Frequently asked questions
Why does dropping needles estimate π?
A needle crosses a seam when its middle is close enough to one, within half its length times the sine of its angle. Because the angle is equally likely to be anything, averaging the sine over all angles brings in π: a needle no longer than the gap crosses with chance 2l ÷ (π t), where l is its length and t the gap. Counting the crossings measures that chance, and solving for π gives the estimate.
How accurate is the estimate?
It gets better slowly. The typical error shrinks like 1 ÷ √n, so with needles as long as the gap about 10,000 drops give π to within roughly 0.02, and a million drops to within roughly 0.002. Watch the Estimate of π chart: the points wander widely at first, then hug the dashed line at π.
What happens with long needles or bent noodles?
A needle longer than the gap can cross several seams, so the chance of crossing at least one follows a more complicated formula, but the average number of seams crossed is still 2l ÷ (π t). That average holds for any curve of length l, which is Barbier's theorem, also called Buffon's noodle. This tool counts every crossing, so all of them estimate π.
How do raindrops estimate π?
A circle drawn inside a square covers π/4, about 78.5%, of the square's area. Drops that land evenly over the square fall inside the circle that often, so four times the share inside estimates π.
Did Lazzarini really get π to six digits?
He reported 3,408 drops and 1,808 crossings, which give exactly 355/113. With that many drops the estimate usually misses π by about 0.05, and only about one run in 70 lands on exactly 1,808 crossings. Lee Badger's analysis suggests the result came from choosing the needle length and when to stop, not from luck.
Is Buffon's needle a Monte Carlo method?
Yes. A Monte Carlo method answers a question by running a random experiment many times and counting the outcomes. Buffon's needle does this for π more than 150 years before Metropolis and Ulam gave the method its name.
References
- Buffon, G.-L. Leclerc, Comte de (1777). Essai d'arithmétique morale. Histoire naturelle, générale et particulière, Supplément 4. Paris: Imprimerie royale.
- Laplace, P.-S. (1812). Théorie analytique des probabilités. Paris: Courcier.
- Metropolis, N., & Ulam, S. (1949). The Monte Carlo method. Journal of the American Statistical Association 44(247), 335–341.
- Ramaley, J. F. (1969). Buffon's noodle problem. The American Mathematical Monthly 76(8), 916–918.
- Badger, L. (1994). Lazzarini's lucky approximation of π. Mathematics Magazine 67(2), 83–91.





