A naturalist's puzzle
Buffon is better known as a naturalist, the author of the many-volume Histoire naturelle. He posed the needle problem in 1733 and published the solution only in 1777, 44 years later.
A floor of equal boards, and a match as long as one board is wide. Drop it at random and count how often it crosses a seam. What share of drops will cross one? Lock in your answer, then check it with a game, a million drops and five explanations.
A floor of equal boards, and a match as long as one board is wide. Drop it at random and count how often it crosses a seam. There are no circles anywhere, yet the share of crossings is 2/π. So thousands of drops give you the number π. Check it with a game, a million drops and five explanations.
The French naturalist Georges-Louis Leclerc, Comte de Buffon, posed the problem in 1733 and published the solution in 1777. It is one of the first problems in geometric probability. There is no paradox here. There is a surprise: a random experiment with no circle in sight produces the number π.
The floor is made of identical boards of width d. The seams between them form parallel lines spaced d apart.
The match, or needle, has a length l no greater than d. We start with the simplest case: l = d, a match exactly as long as a board is wide.
The match lands at random. Its centre can end up anywhere and it can point in any direction. All positions and angles are equally likely.
What share of drops will cross a seam between boards? And how do you get π from that share?
"About half. And where would π come from, with no circles around?"
In fact the share of drops that cross a seam is exactly 2/π ≈ 63.7%. The circle hides in the angle: the direction of the match is a point on a circle, and that is where π comes from.
Short matches (l < d) come up in round 3, long ones (l > d) in round 5.
A match as long as a board is wide. Lock in your answer before you start dropping.
Your answer will be compared with the right one here.
Hard to decide? Open the hints one at a time: the easy one first, then stronger ones.
Only two things matter: how far the centre of the match is from the nearest seam, and its angle. Compare the extremes: along the boards it never crosses, straight across it always does.
Fix the angle θ between the match and the seams. With l = d it crosses when its centre is within (d/2)·sin θ of a seam, which has chance sin θ. Now average that over all angles.
The average of a function over an interval is the area under its graph divided by the interval's length. The angle is uniform from 0 to π/2. What is the area under the sine curve there?
The next rounds show what share of matches cross a seam: your throws, a million throws and the explanation. Answer round 1 first, or go on?
You chose to always show all rounds.
Each match lands in a random spot at a random angle. The ones that cross a seam light up. After every drop the estimate π = 2 · drops / crossings is updated.
The chance of a crossing is P = 2/π, so π = 2/P. For P we use the share of crossings you see on the floor.
Your estimate: twice the number of drops N divided by the number of crossings H.
Recent π estimates after each hundred drops:
The computer drops matches and recomputes the π estimate after every drop. The chart shows the estimate closing in on the true π. The band shows where the estimate lands in 95% of runs. It narrows slowly: 10 times narrower for every 100 times more drops.
Typical error of the π estimate after N drops:
An honest detail: the program doesn't use π to pick a random angle. It takes a random point in a rectangle, throws away points outside a half-disc, and uses the direction to the point that remains as the direction of the match.
Once you answer, the simulation code appears here so you can run it yourself.
The same simulation, short and with no libraries. Run the JavaScript in your browser console (F12) or in Node; the Python needs only the standard library.
// A floor of boards of width d = 1 and a match of the same length. Drop it DROPS times and count seam crossings.
const DROPS = 1000000;
// A random direction without π: a point in a rectangle, kept only if it is inside a half-disc.
function direction() {
for (;;) {
const u = 2 * Math.random() - 1, v = Math.random(), r = Math.hypot(u, v);
if (r > 0 && r <= 1) return u / r; // cosine of the angle across the boards
}
}
let crossings = 0;
for (let i = 0; i < DROPS; i++) {
const centre = Math.random(); // where the match's centre lands, seams at x = 0, 1, 2…
const reach = direction() / 2; // how far half the match reaches across the boards
if (Math.floor(centre + reach) !== Math.floor(centre - reach)) crossings++;
}
const estimate = 2 * DROPS / crossings; // the share of crossings is 2/π, so π ≈ 2 · drops / crossings
console.log(`Drops: ${DROPS}, crossings: ${crossings} (${(100 * crossings / DROPS).toFixed(2)}%, theory ${(200 / Math.PI).toFixed(2)}%)`);
console.log(`π estimate: ${estimate.toFixed(4)}, true ${Math.PI.toFixed(4)}, typical error ±${(2.37 / Math.sqrt(DROPS)).toFixed(4)}`);
# A floor of boards of width d = 1 and a match of the same length. Drop it DROPS times and count seam crossings.
import math
import random
DROPS = 1_000_000
def direction():
# A random direction without π: a point in a rectangle, kept only if it is inside a half-disc.
while True:
u, v = 2 * random.random() - 1, random.random()
r = math.hypot(u, v)
if 0 < r <= 1:
return u / r # cosine of the angle across the boards
crossings = 0
for _ in range(DROPS):
centre = random.random() # where the match's centre lands, seams at x = 0, 1, 2…
reach = direction() / 2 # how far half the match reaches across the boards
if math.floor(centre + reach) != math.floor(centre - reach):
crossings += 1
estimate = 2 * DROPS / crossings # the share of crossings is 2/π, so π ≈ 2 · drops / crossings
print(f"Drops: {DROPS}, crossings: {crossings} ({100 * crossings / DROPS:.2f}%, theory {200 / math.pi:.2f}%)")
print(f"π estimate: {estimate:.4f}, true {math.pi:.4f}, typical error ±{2.37 / math.sqrt(DROPS):.4f}")
Every drop can be described by two random numbers. The chance of a crossing then becomes the area of a shape under a sine curve, and that area is where π enters.
“In plain words” is hidden on all puzzles.
Lay a board-length match across the boards and it always crosses a seam. Lay it along them and it never does. At an angle it spans only part of its length across the boards, and the chance of a crossing equals exactly that part. The angle is random, so the chance has to be averaged over all directions, and a direction can be pictured as a point on a circle. That is where π comes from: on average a match spans 2/π ≈ 64% of its length across the boards, and that is the chance of a crossing. The cards below show how to compute it exactly.
Bend a match or a wire any way you like. The average number of crossings depends only on its length: each tiny piece of wire acts like a tiny match, and averages add up. So the average equals c·L for some constant c. A ring of diameter d has length πd and always crosses the seams at exactly two points. Hence c·πd = 2, so c = 2/(πd). For a straight match of length d that gives 2/π.
| Wire of length πd | Average crossings | Range |
|---|
“Rigorous” is hidden on all puzzles.
x: the distance from the centre of the match to the nearest seam, from 0 to d/2. θ: the angle between the match and the seams, from 0° to 90°. Both are uniform and independent. Half the match reaches sideways by (l/2)·sin θ. The match crosses a seam when that reach gets to it: x ≤ (l/2)·sin θ.
The chance of a crossing is the area under the curve divided by the area of the rectangle.
For a match as long as a board is wide (l = d) the chance is 2/π. That gives an estimate of π from N drops and H crossings.
The average number of crossings for any curve of length L. A ring has length πd.
The typical error of the π estimate after N drops.
The integral of sine from 0 to π/2 equals 1, so the area under the curve is just l/2. The area of the whole rectangle contains π/2, because the angle runs from 0 to π/2. That denominator is where π appears.
“Deeper” is hidden on all puzzles.
| Drops | Typical error | Reliable decimals |
|---|
The share of crossings wobbles around 2/π, and its typical deviation shrinks like 1/√N. To get one more correct digit you need a 10 times smaller error, which takes 100 times more drops. That's why nobody computes π with matches: it's a way to see π, not to calculate it.
What if the match is longer than a board? What if the floor is square tiles? And is it faster to find π by throwing points into a square? Every formula here is checked by simulation.
The chance of at least one crossing for a short needle.
The same for a long needle.
The average number of crossings for a needle of any length.
A long needle can cross several seams, so the chance of "at least one crossing" grows more slowly than the average and heads towards 100%. The average number of crossings stays 2l/(πd). So you can estimate π with a needle of any length, as long as you count every crossing.
Each row has already been checked on 100,000 drops. "Again" runs a new batch. The "Error" column is the typical error of the π estimate after 10,000 drops: the smaller it is, the faster the method converges.
| What we throw | Theory | π formula | Error | Simulation |
|---|
The most accurate is the square grid that Pierre-Simon Laplace studied: almost every drop crosses a line, and π is set by the small share of misses. The classic Monte Carlo method with points in a square converges faster than the needle on lines, but more slowly than the grid.
In the 19th century people really did look for π with needles. Their results can be checked against the typical error, and then you can drop matches on your own floor.
| Who, year | l/d | Drops | Crossings | π | Typical error |
|---|
π = 2 · l · drops / (d · crossings). The typical error is how far an honest result usually strays with that many drops. Smith counted his 11 borderline touches as 5½ crossings. In his third series Fox threw a wire longer than the line spacing and counted every crossing.
Wolf, Smith and Fox's first series missed π by less than their typical error, which is what an honest result looks like. Fox's last two series came much closer than their number of drops allows: by chance that happens about once in 250 and once in 2,000 series. Lazzarini came as close as chance allows about once in 240,000 series, which is why his result is considered rigged.
Sources: Wolf: E. Czuber, "Geometrische Wahrscheinlichkeiten und Mittelwerte" (1884, transl. R. Pulskamp); Smith: A. De Morgan, "A Budget of Paradoxes" (1872); Fox: A. Hall, "On an experimental determination of π" (Messenger of Mathematics, 1873); Lazzarini: S. Lototsky's notes (USC), L. Badger, Mathematics Magazine 67 (1994).
You need matches or toothpicks and a floor with boards, tiles in even rows, or lined paper. The match must be no longer than the line spacing. Drop from a height so the angle is random.
Give the length and the spacing in the same units, say centimetres.
Buffon is better known as a naturalist, the author of the many-volume Histoire naturelle. He posed the needle problem in 1733 and published the solution only in 1777, 44 years later.
In 1901 the Italian Mario Lazzarini reported 3,408 drops of a needle (l/d = 5/6) with 1,808 crossings. That gives π ≈ 355/113 = 3.1415929, six correct decimal places. Such accuracy from 3,408 drops is widely seen as rigged: the number of drops looks chosen to stop exactly at 355/113.
The fraction 355/113 was found by the Chinese mathematician Zu Chongzhi back in the 5th century. It gives π to six correct decimal places. To reach that accuracy honestly with a needle you would need tens of trillions of drops.
In 1860 Joseph-Émile Barbier developed the "noodle" idea and proved that every curve of constant width w has perimeter πw. The argument is the one from round 4: such a curve dropped on parallel lines always gives two crossings, just like a circle.
Buffon's needle is often called one of the first examples of the Monte Carlo method: computing with random experiments. The name itself appeared in the 1940s at Los Alamos, where Stanislaw Ulam, John von Neumann and Nicholas Metropolis developed the method.
Pierre-Simon Laplace moved the problem to a grid of rectangles. For square tiles of side d and a needle of length d, the chance of crossing at least one line is 3/π ≈ 95.5%. You can check it in round 5.
Share your own explanation, an objection or a variant of the puzzle. You need a GitHub account to comment.
Is “Advanced” the right level for this puzzle?
Thank you! This helps set the levels right.
I keep adding new puzzles, new ways to explain them and write-ups of the discussions they start. Leave your email and I'll write when something new is out. No spam, one-click unsubscribe.
The sign-up form will appear here soon.