CurvG
Sign In

No. 9 · Probability · Geometry

Drop needles on a floor ruled with parallel lines: why does that give you π?

When the needles are as long as the gap between lines, about 63.66% of them land across a line, and that share is exactly 2/π. The more you drop the better the estimate, but painfully slowly. Bend the needle into a noodle, then a ring, and you can see where the π comes from.

Why?

The explanation

The average number of crossings depends only on a needle’s length, not its shape; a ring as wide as the gap always crosses exactly twice yet is π times its width around, which is how π gets into the ratio. Random throws can estimate π, but the error only shrinks like 1/√N: one more correct digit costs a hundred times more needles.

01The chance of a crossing

Let the lines be dd apart and the needle l≤dl\le d long. A needle is fixed by two numbers: the distance yy from its middle to the nearest line (uniform between 00 and d/2d/2) and its angle θ\theta to the lines (uniform between 00 and π\pi). It crosses exactly when

y≤l2sin⁡θy\le\frac{l}{2}\sin\theta

Draw every possible (θ,y)(\theta,y) as a rectangle: the crossings are the area under a sine curve,

P=∫0πl2sin⁡θ dθπ⋅d2=2lπdP=\frac{\displaystyle\int_0^\pi\frac{l}{2}\sin\theta\,d\theta}{\pi\cdot\frac{d}{2}}=\frac{2l}{\pi d}

With l=dl=d, P=2/π≈63.66%P=2/\pi\approx63.66\%. The π comes from averaging over the angle.

02Why the estimate is so slow

Drop NN needles with CC crossings and estimate π^=2lNdC\hat\pi=\dfrac{2lN}{dC}. CC is binomial, with relative fluctuations of order 1/N1/\sqrt N. With l=dl=d the estimate has standard deviation about

σ≈2.37N\sigma\approx\frac{2.37}{\sqrt N}

About 0.024 after ten thousand needles, about 0.05 for two standard deviations: usually one decimal place. To be within 0.001 takes more than twenty million. That is the Monte Carlo method in a nutshell: it can estimate almost anything, but each extra digit costs a hundred times more.

03Buffon’s noodle

Cut the needle into many tiny pieces. Each piece crosses a line on average in proportion to its length (its direction is random), and averages add up. So for a "noodle" of any shape,

E[crossings]=k⋅LE[\text{crossings}]=k\cdot L

with one and the same constant kk. A ring of diameter dd meets the lines exactly twice wherever it lands, and its length is L=πdL=\pi d, so 2=kπd2=k\pi d and k=2πdk=\dfrac{2}{\pi d}. A straight needle of length ll crosses at most once, so its chance of crossing is 2lπd\dfrac{2l}{\pi d}. No integral needed: the π comes from the circumference of a circle.

04Lazzarini’s luck

In 1901 the Italian mathematician Lazzarini reported needles 5/6 of the gap long, 3408 thrown and 1808 crossing:

π^=2⋅56⋅34081808=355113=3.1415929…\hat\pi=\frac{2\cdot\frac56\cdot3408}{1808}=\frac{355}{113}=3.1415929\ldots

off by only 0.0000003. With the error above, about 0.05 for 3408 needles, that accuracy should be all but impossible.

The catch: to get 355113\frac{355}{113} the number thrown must be a multiple of 213 (3408 = 16 × 213), and the crossings must then match exactly. The chance of exactly 1808 crossings in 3408 throws is about 1.4%; watching as you go and stopping at the right moment, or simply making the numbers fit, makes it far easier. Statisticians often cite it as an example of choosing when to stop.

Questions

What if the needle is longer than the gap?

Then one needle can cross two lines at once, and the chance of crossing is no longer $2l/(\pi d)$. But the average number of crossings is still $2l/(\pi d)$ (the noodle argument does not need $l\le d$), so counting crossings rather than needles still estimates π. The stage keeps needles no longer than the gap.

Are the needles on the stage really random?

Free play uses fixed seeds hashed per needle, a new seed each time you clear; the story uses one fixed seed, so it plays the same every time and ten thousand needles always give 3.1546. Statistically neither can be told apart from true randomness here.

Is there a faster random way to estimate π?

Scatter points in a square and count the share inside the inscribed circle (π/4): the error also shrinks like $1/\sqrt N$, just with a smaller constant. Every dice-throwing method shares that $1/\sqrt N$ limit; to actually compute π, people use series that converge extremely fast.

The syllabus side

Related curves

Sources: Buffon’s needle problem — Wikipedia · Buffon’s noodle — Wikipedia