Why it happens

Why Dropping Needles on a Floor Finds π

A needle as long as a floorboard is wide crosses a crack with chance 2/π, so twice the number of drops divided by the number of crossings estimates π. It works, slowly: in the model, 10,000 needles gave 3.1377, and the error shrinks only with the square root of the number of drops.

10,000 needles on a wooden floor

StopNeedles on a floor
Needle length, in boardsNeedles droppedSeed
Needles0Crossings0π ≈–Off by–

The floor

Needles that cross a line

The estimate of π as needles fall

22.533.54π ≈1101001,00010,000drops →π

The dashed lines either side of π are two standard errors: once the count is in the hundreds, roughly 95 runs in 100 sit between them.

1/16Lines run across the floor one board apart, and each needle is as long as a board is wide. 10,000 needles will fall, each landing at a random spot and pointing a random way. A needle this long crosses a line with chance 2L/(πd), 63.7%, so counting crossings measures π.

  • CH1 the run's estimate of π

Watch the Python behind this model run, line by line

How to read the stage

Objective
Read the floor, the tally and the estimate, and say how far the run is from π at each count.
How this step gets you there
The text names each panel and gives the default run's estimate at three counts.

Each needle lands at a random spot and points a random way. The floor shows the first 300, lit when they cross a crack. The tally sets the share that crossed against 2/π, 63.7%. The bottom panel tracks 2 × drops ÷ crossings on a log scale of drops. With seed 1777 it reads 4.0000 after 50 needles, 3.2103 after 1,000 and 3.1377 after 10,000.

Why π shows up

Objective
Explain where π enters a problem with no circle in it.
How this step gets you there
The text gives the crossing rule the stage's single drops walk through, then averages it over every tilt.

Only the nearer crack matters. A needle crosses when its center sits closer to that crack than the needle reaches, and its reach depends on its tilt: half its length times the sine of its angle to the cracks. Averaged over every tilt, that sine comes to 2/π. So a needle of length L on cracks d apart crosses with chance 2L/(πd), for L no longer than d.

Why it takes so many needles

Objective
Measure how the estimate's error shrinks with more drops, and price an extra decimal place.
How this step gets you there
The stage plots 100 runs at three counts inside a funnel of two standard errors, and the text reads the typical miss.

The second stage runs 100 floors and reads each after 10, 100 and 1,000 needles. The typical miss went from 0.642 to 0.192 to 0.046. Over 200 seeds, each tenfold step shrank it about 3.2 times, close to √10. The error falls like 1/√n, so each extra correct decimal costs about a hundred times the needles. After 10,000, one standard error is still 0.024.

100 floors, read after 10, 100 and 1,000 needles

StopMany runs
RunsSeed
Drops per run–Typical miss–

100 runs, each read after 10, 100 and 1,000 drops

22.533.544.55π ≈π10 drops100 drops1,000 drops

Each dot is one run's estimate. Dots within 0.1 of π are lit. The dashed funnel is two standard errors either side of π; estimates past the edges are drawn at the edge.

The typical run's miss

1/5100 separate runs, each dropping 1,000 needles as long as a board is wide. Each run's estimate of π is read after 10, 100 and 1,000 drops.

  • CH1 one run's estimate

Watch the Python behind this model run, line by line

Buffon, then Laplace

Objective
Know who posed the needle problem, who solved it, and who first turned it into a way to measure π.
How this step gets you there
The text follows the problem from Buffon's 1733 notice and 1777 essay to Laplace's 1812 book and an early experiment.

Buffon put the needle problem to the Académie royale des sciences in 1733, beside his franc-carreau game, and published his solution in 1777 in his Essai d'arithmétique morale. He never used it to find π. Laplace suggested that in 1812, in his Théorie analytique des probabilités, and gave the right answer for a grid of crossing lines, a version Buffon had got wrong. Around 1850, Wolf in Zurich threw a needle 5,000 times and got 3.1596.

The result that was too good

Objective
Say why Lazzarini's famous result is not evidence that the method is accurate.
How this step gets you there
The text checks his numbers against the formula and against the spread an honest run of that length shows.

In 1901 Mario Lazzarini reported that a machine dropping a 2.5 cm stick on lines 3 cm apart gave 1,808 crossings in 3,408 throws: 355/113, or 3.1415929. With that stick, 355/113 comes out only when the throws are a multiple of 213, and 3,408 is 16 × 213. For an honest run that long, one standard error is about 0.05. Coolidge, Gridgeman and Badger all doubted it.

What the model leaves out

Objective
Name the ways the simulated floor differs from a real one, and why its misses are luck rather than the grid.
How this step gets you there
The text says how the model places and points a needle, and what its exact long-run answer is.

Real needles bounce and roll; the model's land flat where they fall. Its floor and its directions sit on a fine grid: centers at 1,200 spots across a board, and directions from points in a ring, kept only if they land inside it, so the model never uses π to pick an angle. Averaged over every spot and direction, its exact crossing chance gives π to four decimals, 3.1416.

Questions

Did Buffon use the needle to calculate π?
No. Buffon worked out the chance of a crossing, but Gorroochurn and Levin note that nowhere in his writings does he suggest estimating π with it. Laplace made that suggestion in 1812. The 2,048 trials sometimes cited as his needle experiment were games of coin tossing he had a child play, for a different problem.
How many needles do you need to get π right?
With needles as long as the boards are wide, the standard error after n drops is about 2.37/√n. That is 0.024 after 10,000 needles, 0.0024 after a million, and 0.00024 after 100 million. Each extra correct decimal takes about a hundred times as many needles.
Doesn't a computer simulation need π to pick the angle?
If it picks an angle in degrees or radians, yes, which makes the estimate circular. This model avoids it: it picks a random point in a box and keeps it only if it falls in a ring around the center. The needle points toward that point, so every direction is very nearly equally likely and no angle is ever chosen.
Why does π appear when there are no circles?
Because the needle can point any way. Its reach toward the nearest crack is set by the sine of its angle, and the average of that sine over every direction is 2/π. The circle is the set of directions the needle can face.

More of how it works