A wooden floor of parallel planks, all the same width. A needle is dropped on it and lands wherever it lands: sometimes clear inside a plank, sometimes across the line between two. The needle is exactly as long as a plank is wide.
Drop it 1000 times and count the crossings. What fraction of the drops cross a line?
There is no circle anywhere in the room. There is a floor and a pin.
Write for the width of a plank and for the length of the needle. The verifier fixes , so a length is a number of planks, and puts the seams at the whole numbers.
A drop is two numbers.
The two are independent: where the centre lands tells you nothing about which way the needle points. That independence is the whole of the assumption, and the film, the verifier and the proof below all use it.
Take the seam nearest the centre. The needle runs a vertical distance up or down from its centre (the angle is measured from the seams, so is how steeply it climbs). It reaches the seam exactly when the centre is no further away than that:
Could it also reach the far seam? That one is at distance , and the needle reaches at most . So it cannot, except on drops of probability zero, and "crosses the nearest seam" is the same as "crosses a line". This is where is used.
Now the probability. The pairs fill a box, from to and from to , evenly, so a probability is an area divided by the area of the box:
The crossing drops are the ones under the curve , the lobe in the film. Because , the lobe sits inside the box. Its area is
So
For the lobe has area and the box has area , and . In the verifier's units that is 0.63662, and the film's "about sixty-four percent". The same sum for needles of , , and 1 plank gives 0.159155, 0.31831, 0.477465 and 0.63662.
Nothing here is round, but the answer is. The is the length of the interval of angles, since runs from to . A viewer is entitled to suspect that is a trick of the set-up, and route two answers it.
Stop asking whether the needle crossed and ask how many times. Count every place where the wire meets a seam. For a straight needle that count is or when , so its expected value is the probability. But the count also makes sense for a wire of any shape, bent however you like.
Call the expected number of crossings of a wire dropped at a random position and angle. Three steps.
1. Crossings add. Cut a wire into two pieces. On every drop, every crossing belongs to one piece or the other, so the whole wire's count is the sum of the pieces' counts. (A seam could pass exactly through the cut, but that has probability zero.) Expectations add, so
2. The expected number depends on length and on nothing else. Dropping a whole wire at a random position and angle drops each piece of it at a random position and angle too, so a piece's does not depend on where it sits in the wire. Look at straight pieces first. Let be the expected number of crossings of a straight wire of length . By step 1, . So for whole , and then , so for every rational . And never decreases as grows, since a longer wire has at least the crossings of a shorter one lying inside it. A function that is additive and never decreasing is squeezed between rationals on both sides, so for one constant .
A wire made of straight pieces, a polygon, is a sum of such pieces, so its is times its length. The film then treats a curve as a limit of polygons, and that last step is the standard one, not proved here:
3. Find with the easiest shape. Bend a wire into a circle exactly one plank across, so its diameter is and its length is . Wherever it lands, it spans a vertical stretch of exactly , and a stretch of length always contains exactly one seam (apart from the drops that put one exactly on its edge). A circle meets a line it reaches in two places. So the count is on every drop, with no chance left in it:
The circle meets one line, in two places, which is why the film says "in exactly two places" and not "two lines".
4. Unbend it. A needle of length crosses at most one line, so its expected count is its probability:
This is route one's answer with no integral and no angle. The is now the ratio of a circle's length to its width. Both routes are about the same , and the circle is not in the room: we bent it ourselves.
For the needle can meet two lines or more. Now the probability of crossing at least once and the expected number of crossings are different things, and only the second keeps its formula. By step 2, a wire of length has for any : cut it into pieces each no longer than , and add. But
so once a second crossing is possible, falls short of .
With and , the chance given the angle is capped at 1, and the integral becomes
The verifier simulates and finds the probability 0.77901, below the formula , and the average number of crossings 0.955661, which matches it. That is why the film prints .
If a fraction of drops cross, then the estimate is , where is the observed fraction (a tilde marks an estimate; the film writes it with a hat). Two facts decide how good that is.
The fraction is binomial. Each drop crosses with probability , independently. So has variance and has standard deviation .
Turn the fraction into an estimate of . For a small error, , so the spread of is times the spread of . With that is
This is an approximation that gets better as grows (it is the first term of a Taylor expansion, often called the delta method). The verifier checks it by experiment, below.
The is the whole story. Every drop adds an independent amount of noise of the same size. Independent noise adds in variance, so after drops the variance of the average is the variance of one drop divided by , and the standard deviation shrinks like . To halve the error, drop four times as many needles. To gain one more decimal digit, a tenth of the error, drop a hundred times as many.
A 95% interval is standard deviations either side:
| Drops | Spread of the estimate | 95% half-width |
|---|---|---|
| 100 | 0.2374 | 0.4652 |
| 1000 | 0.0751 | 0.1471 |
| 10,000 | 0.0237 | 0.0465 |
| 100,000 | 0.0075 | 0.0147 |
| 1,000,000 | 0.0024 | 0.0047 |
| 100,000,000 | 0.0002 | 0.0005 |
The film's closing caveat asks how many drops it takes before the 95% half-width is under half a unit in the last digit shown. That is a rule of thumb for "sure of that digit", not a guarantee that the digit is right, but the count is exact for the rule:
| Digits | Drops needed | The film says |
|---|---|---|
| 3.1 | 8657 | about 8700 |
| 3.14 | 865,672 | about 870,000 |
| 3.142 | 86,567,136 | about 87,000,000 |
| 3.1416 | 8,656,713,593 | (not shown) |
Each row is a hundred times the one above. Pi is in there. It is a dreadful way to find it.
The film's first five drops come from the verifier's seeded generator: 4 of the five crossed a line, and one lay clear. Five drops say almost nothing, and the film goes on to a thousand.
The running count of the same run, with the estimate at each stage. The spread is the formula's :
| Drops so far | Crossed | Estimate of |
|---|---|---|
| 10 | 5 | 4 |
| 30 | 19 | 3.1579 |
| 100 | 63 | 3.1746 |
| 300 | 199 | 3.0151 |
| 1000 | 646 | 3.096 |
At 1000 drops the estimate is 3.096, which is -0.0456 from . The spread at that size is 0.0751, so the error is well inside one spread and inside the 95% band of 0.1471. That is whatever the seed gave. If the run had landed further out the film would have said so, and the verifier only requires the estimate to sit within three spreads of , at every checkpoint.
After the first ten drops, the running estimate was inside its 95% band at a fraction 0.999 of the stages. That is not 95% of independent trials: neighbouring stages share their drops, so they move together.
Drops 2 and 3 of the five crossed and drop 5 lay clear, which is what the narration says, and the script asserts it.
Any width. The proof never used . Scale the plank and the needle together and nothing changes, because only the ratio matters: the claim is .
Any wire. The expected number of crossings of a wire of length is whatever its shape. The verifier drops five wires, 250,000 times each:
| Wire | Length | Expected crossings, | Average found |
|---|---|---|---|
| Needle | 1 | 0.6366 | 0.6373 |
| Squiggle | 1 | 0.6366 | 0.6377 |
| L | 2 | 1.2732 | 1.273 |
| Zigzag | 3 | 1.9099 | 1.9092 |
| Circle | 3.141593 | 2 | 2 |
Every average lands on for its own length, whatever the shape. What the shape does change is the spread of the count: 0.4808 for the needle, 0.7873 for the squiggle of the same length, and 0.021 for the circle. The circle's count barely varies (a true circle meets the lines exactly twice on every drop; the script's circle is drawn as a fine polygon, which on a very few drops grazes a line, and that is the small spread), which is what made it the easy shape to use.
Seeing a wire. Turn the claim around and it measures length. Lay a grid of parallel lines over a map, count the places a path crosses, and (crossings) is an estimate of the path's length, with the same trade-off.
scripts/needle.mjs writes this page's numbers and asserts them first.
Route one. The probability for needles of , , and 1 plank is found three independent ways and compared with : a midpoint-rule integral over the box, Simpson's rule on (matches to ), and a seeded simulation of 2,000,000 drops. For the simulation gave 0.636948 from 1,273,896 crossings, against 0.63662. The script also asserts that for the probability is no longer while the expected number of crossings still is.
Route two. A wire is bent by interpolating its tangent angles, and the script asserts its length stays exact at every stage of the bend. The circle closes and is one plank across in both directions. Cutting a wire in two adds the counts, checked on every one of 20,000 random drops per shape. Every drop of the circle meets the lines in exactly two places, in 250,000 drops and in all 200 of the film's.
The run. The film's 1000 drops are generated by a seeded generator inside the script, with seeds fixed before looking and never changed. The script recomputes every verdict from the rounded coordinates the film uses, and checks that each drop is inside the sine lobe exactly when it crossed. The spread formula is tested against repeated runs: 6000 runs of 100 needles had a spread of 0.243 (predicted 0.2374), and 4000 runs of 1000 had 0.0763 (predicted 0.0751). The 95% interval covered in a fraction 0.9442 and 0.9425 of those runs, and the script requires it to be within a point and a half of 95%.
What is not checked. The step from polygons to curves in Barbier's argument is a standard limit and is neither proved on this page nor tested by the script. The closed form for is derived here and not asserted: the script only simulates that case. The delta-method formula is tested by experiment, not proved to hold exactly. The historical points below are outside the script.
, or 0.31831. Half the needle, half the chance of .
Its length is , so the expected number of crossings is . The circle spans a height of . It has a seam inside that span with probability , and then it crosses twice; otherwise it crosses nowhere. So it crosses at all with probability , and , as it should.
with planks is 1.2732. Nothing says the count has to be at most one: the wire can meet several lines on one drop. The verifier's L-shaped wire of that length averaged 1.273.
865,672 by the film's rule, about 870,000. The spread falls like , so a tenfold smaller spread needs a hundredfold more drops, and each new digit is a tenfold smaller target.