← Math problems

Buffon's needle Drop a match on the floor. Get π.

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 throws and five explanations.

63.7%of drops cross a seam
π ≈ 2N/HN drops, H crossings
The puzzle

Picture this: a box of matches and a wooden floor

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 π.

  1. 1

    The floor

    The floor is made of identical boards of width d. The seams between them form parallel lines spaced d apart.

  2. 2

    The match

    The match, or needle, has length l no longer than d. We start with the simplest case: l = d, a match exactly as long as a board is wide.

  3. 3

    The drop

    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.

  4. 4

    The question

    What share of drops will cross a seam between boards? And how do you get π from that share?

Intuition says

"About half. And where would π come from, with no circles around?"

In fact 63.7% of drops cross a seam, exactly 2/π. The circle hides in the angle: the direction of the match is a point on a circle, and that is where π comes from.

Model assumptions

  • The floor is endless, so walls don't get in the way.
  • The match is a line segment with no thickness.
  • Centre position and angle are independent and uniform.
  • A match that only touches a seam has probability zero.

Short matches (l < d) come up in round 3, long ones (l > d) in round 5.

Round 1 · Guess

What share of matches will cross a seam?

A match as long as a board is wide. Lock in your answer before you start dropping.

50%
1%25%50%75%99%

Your answer will be compared with the right one here.

Round 2 · Drop matches

A floor, some matches and a π counter

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.

Drops0
Crossings0
Share–
π estimate–

How matches turn into π

The chance of a crossing is P = 2/π, so π = 2/P. For P we use the share of crossings you see on the floor.

Error against π = 3.14159…
–

Recent π estimates after each hundred drops:

Round 3 · Simulation

A million throws in a second

The computer drops matches and recomputes the π estimate after every throw. 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 throws.

true π 95% of runs current run earlier runs
–
Share of crossings: theory 2l/(πd)
–

Typical error of the π estimate after N throws:

An honest detail: the program doesn't use π to pick a random angle. It takes a random point in a square, throws away points outside a half-disc, and uses the direction to the rest.

Round 4 · Five explanations

Where π comes from in dropped matches

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.

Two random numbers

Distance to the seam and the angle

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 area under a sine curve

Every drop is a point in a rectangle

Buffon's noodle

A ring always gives two crossings

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/π.

Why it is so slow

Each new digit costs 100 times more throws

ThrowsTypical errorReliable 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 throws. That's why nobody computes π with matches: it's a way to see π, not to calculate it.

For formula lovers

The integral, the noodle and the error

P = area under the curve / area of the rectangle = ∫0π/2 (l/2)·sin θ dθ ÷ (π/2 · d/2)
P = (l/2) ÷ (πd/4) = 2l / (πd)  →  l = d: P = 2/π ≈ 0,6366  →  π ≈ 2N / H
E[crossings] = 2L / (πd)  for any curve of length L  →  ring: L = πd, E = 2
σ(π̂) ≈ π · √((1 − P) / (P · N))  →  l = d: σ ≈ 2,37 / √N

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.

Round 5 · Variations

Long needles, Laplace's grid and points in a square

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.

A long needle: l greater than d

At least one crossing
Crossings on average

l ≤ d: P = 2l / (πd)
l > d: P = 1 + (2/π) · (l/d − √((l/d)² − 1) − arcsin(d/l))
any l: E = 2l / (πd)

A long needle can cross several seams, so the chance of "at least one crossing" grows more slowly 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.

Chance of crossing and the average

at least one crossing average number of crossings

Other random ways to get π

Each row has already been checked on 100,000 throws. "Again" runs a new batch. The "error" column is the typical error of the π estimate after 10,000 throws: the smaller it is, the faster the method converges.

What we throwTheoryπ formulaErrorSimulation

The most accurate is the square grid that Pierre-Simon Laplace studied: almost every throw 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.

Bonus · Fun facts

Things to tell your friends

1733

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.

3408

Too good to be true

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 decimals. Such accuracy from 3,408 drops is widely seen as rigged: the number of drops looks chosen to stop exactly at 355/113.

355/113

Zu Chongzhi's fraction

The fraction 355/113 was found by the Chinese mathematician Zu Chongzhi back in the 5th century. It gives π to six correct decimals. To reach that accuracy honestly with a needle you would need tens of trillions of drops.

1860

Barbier's theorem

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.

1940s

The Monte Carlo method

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.

3/π

Laplace's grid

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.

Discussion

What do you think?

Share your own explanation, an objection or a variant of the puzzle. Commenting needs a GitHub account.

Newsletter

New puzzles, explanations and discussions

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.