Pi, by dropping needles

no circle in sight, and yet the circle's number falls out of a count

Rule a floor with parallel lines, one needle-length apart. Drop a needle at random — it lands however it lands — and ask only one question: does it cross a line, or lie between them? Repeat. Nothing in the room is round. There is no diameter to measure and no circumference to wrap a string around. And yet, if you keep count, a familiar number assembles itself out of the tally: π ≈ 2 × drops ÷ crossings.

The reason is one piece of averaging. A needle crosses when its centre falls close enough to a line and it points steeply enough across it. Averaged over every possible angle, the chance of crossing works out to exactly 2/π — about 0.637. The π was never in the needle or the floor; it is in the average over angles, because averaging a direction over a half-turn is secretly a question about a circle. So the crossing rate is a measurement of π, read backwards: crossings ÷ drops ≈ 2/π, turned over, gives the formula above. In general, for a needle of length L and lines spaced d apart, the chance is 2L/(πd) and π ≈ 2L × drops ÷ (d × crossings). This page uses L = d, the case where the two cancel.

Drops: 0 · Crossings: 0 · π from the count: — (true π = 3.14159…)

The price of this instrument is written into it, and the buttons above will make you feel it: the estimate improves only as fast as chance allows. Halving the typical error takes about four times as many drops, because random tallies steady themselves with the square root of the count — a hundred drops know π to a couple of tenths, ten thousand to a couple of hundredths, and each further decimal costs a hundredfold. It is a ruler made of luck: perfectly honest, unbiased, and in no hurry at all. Counting is a way of measuring, but the count pays for precision in bulk.

Checked before shipping, by executing this page's own functions in Node: the crossing chance for a needle as long as the line spacing is 2/π = 0.63662; a simulated million drops crossed within a few tenths of a percent of that rate and returned π to three decimals, as the square-root price predicts; counting a needle that touches a line as crossing changes nothing that matters, since an exact touch has probability zero. The page's randomness is a browser's ordinary pseudorandom generator — good enough for a count like this, and the page claims nothing that needs better.