Buffon's Needle
Drop a needle of length l onto a floor ruled with parallel lines a distance d apart. When the needle is no longer than the gap, the chance it crosses a line is 2l/(πd). PictorX runs the throws for you, draws each one, and turns the count around so the same experiment estimates π. Press play to drop needles at random. A crossing estimates π. With the needle at half the gap, π is about throws divided by crossings. Drag on the floor to place one needle by hand; that one is not counted.
How it works
- Open this page and press play. Needles fall on the lines at random.
- Watch π settle. With the needle at half the gap, it is throws divided by crossings.
- Open the sine diagram, place one needle by hand, or drop a thousand at once, then save a PNG.
Two numbers decide a crossing
A throw is fixed by the distance x from the center of the needle to the nearest line, and by the angle θ between the needle and the lines. x runs from 0 to d/2. θ runs from 0 to π, because a needle has no head and a half-turn covers every direction. The needle crosses when x ≤ (l/2) sin θ.
The short-needle formula
For l ≤ d the chance of a crossing is P = 2l/(πd). The pairs (θ, x) fill a rectangle π wide and d/2 tall. The crossings are the area under the sine curve, and that area is l. Dividing the two areas leaves π in the denominator. At l = d/2 the chance is 1/π, so π is about throws divided by crossings.
A slow way to find π
The rearranged formula is π ≈ 2l·N / (d·N_hit). It is a Monte Carlo estimate, and an inefficient one. A few thousand throws usually make the first digits recognizable. The next digit takes a much larger count. The ± beside the readout is one standard error of the ratio. Drag on the floor to lay a single needle and see its x and θ. That needle is drawn and left out of the count.
Frequently asked questions
What is Buffon's Needle?
A needle of length l dropped on parallel lines spaced d apart. For a short needle, l ≤ d, the chance it crosses a line is 2l/(πd).
Why does the answer contain π?
The needle's direction is an angle from 0 to π. All possible falls fill a rectangle that wide, and the crossings are the area under a sine curve. Dividing those areas leaves π in the denominator.
How does the experiment estimate π?
Count throws N and crossings N_hit. Then π ≈ 2l·N / (d·N_hit). With the needle at half the gap this is throws divided by crossings.
Why is a hand-placed needle left out of the count?
The estimate needs a random position and a random angle. A needle you drag into place is drawn so you can see x and θ, and it is not added to N or N_hit.
Ready to try it?
Open PictorX in your browser — no install, no credit card required to start.
Go to Editor