Math paradoxes

Buffon's needle Drop a match on the floor. How often does it cross a seam?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. 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.

Make a guess
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 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.

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

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.

Your answer will be compared with the right one here.

Hints

Hard to decide? Open the hints one at a time: the easy one first, then stronger ones.

Next: the solution

Next comes the explanation, with spoilers

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.

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.

Your estimate: twice the number of drops N divided by the number of crossings H.

Error against π = 3.14159…
–

Recent π estimates after each hundred drops:

Round 3 · Simulation

A million drops in a second

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.

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

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.

Check it yourself in code

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.

JavaScript
// 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)}`);
Python
# 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}")
Round 4 · Six 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.

In plain wordspictures, analogies, small numbers

“In plain words” is hidden on all puzzles.

Across and along

It all comes down to the angle of the match

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

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

Wire of length πdAverage crossingsRange
Rigoroustables, charts, formulas

“Rigorous” is hidden on all puzzles.

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

For formula lovers

The integral, the noodle and the error

The chance of a crossing is the area under the curve divided by the area of the rectangle.

P=area under the curvearea of the rectangle P=∫0π/2(l2)·sinθdθπ2·d2 P=l2πd4=2lπd

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.

l=d:P=2π≈0.6366 π≈2NH

The average number of crossings for any curve of length L. A ring has length πd.

E[crossings]=2Lπd ring:L=πd,E=2

The typical error of the π estimate after N drops.

σ(π^)≈π·1−PP·N l=d:σ≈2.37N

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.

Deepergeneralisations, theory, history

“Deeper” is hidden on all puzzles.

Why it is so slow

Each new digit costs 100 times more drops

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

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

The chance of at least one crossing for a short needle.

l≤d:P=2lπd

The same for a long needle.

l>d:P=1+2π·(ld−(ld)2−1−arcsin(dl))

The average number of crossings for a needle of any length.

anyl:E=2lπd

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.

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 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 throwTheoryπ formulaErrorSimulation

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.

Real data and you

Needles on real floors

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.

Historical experiments
Who, yearl/dDropsCrossingsπ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).

Try it on your floor

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.

Your π–
Typical error–

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

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 decimal places. 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.

How Not to Be Wrong

Jordan Ellenberg

2014 · chapter 11

A History of Pi

Petr Beckmann

1971 · chapter 15

All books →
Discussion

What do you think?

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.

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.