Skip to content
Knowledge Syndicate
Math Facts

Buffon’s needle: how dropping needles on the floor gives you pi

By
Buffon's needle: needles on parallel lines and pi estimates with 100, 1,000, 10,000, 100,000 and a million throws

Grab a box of matches and toss them onto a wooden floor. Count how many land across a line between boards. Do the right sum and, if you throw enough, you get something close to 3.14. That’s Buffon’s needle. It sounds like a fairground trick, and it has two named parents and two texts you can read. Neither of them took the idea of calculating pi with matchsticks very seriously. Let’s see why.

Buffon’s needle started as a betting game

In 1777 the fourth volume of the supplement to the Comte de Buffon’s Natural History came out. Inside is a text called Essay on Moral Arithmetic. There, among reflections on risk and expectation, Buffon analyses games of chance in which only geometry matters.

The first is the game of franc-carreau. A coin is tossed onto a tiled floor and one player bets it will land inside a single tile, touching no joint, while the other bets it will touch one. Buffon works out how big the tile must be compared with the coin for the bet to be fair, depending on whether the tiles are triangular, square, diamond-shaped or hexagonal. For those sums he takes the circumference to be 22 sevenths of the diameter.

Then he complicates the game with more players. One bets the coin will land on several joints at once: six on triangular tiles, four on square or diamond ones, three on hexagonal ones. He solves it by drawing, at the corner of the tile, a circle the size of the coin. Other cases he leaves out, he says, because they are no harder and because the game is rarely played under other conditions.

Then he takes the leap. If instead of a round coin you toss a piece of another shape, such as a square Spanish pistole, which was a coin, or a needle, or a rod, the problem needs a bit more geometry. Even so, he writes, it can always be solved by comparing areas.

A rod on the floorboards

Buffon’s set-up is this. In a room whose floor is divided only by parallel joints, a rod is tossed into the air. One player bets it won’t cross any joint and the other that it will. What are each player’s chances? He adds a homely detail: you can play on a draughts board with a sewing needle or a headless pin.

To solve it, Buffon draws two helper lines half a rod’s length from each joint. As long as the centre of the rod lands between those lines, it can never cross. Outside that strip, it crosses or not depending on the angle. He represents all possible positions of the rod by a quarter of a circle whose diameter is the rod itself, and adds up the crossing cases with an integral.

For the game to be fair, he concludes, the rod should be roughly three quarters of the distance between joints.

The square-tile case

Buffon also solves the square-tile version, harder at first sight. For the bet to be fair, the side of the tile must be nearly twice the rod, though not quite.

And he draws a practical consequence. If you played on a draughts board with a needle half as long as the side of each square, it would pay to bet that the needle crosses the joints.

What’s curious is what he doesn’t say. In the whole passage Buffon never suggests using the game to calculate pi. What interests him is who has the edge in the bet. At the end of the section he suggests other similar questions one could ask, such as how much you risk crossing a river on a more or less narrow plank, or how much you should fear lightning.

Laplace turns it around

In 1812 Laplace published his Analytical Theory of Probabilities. In the chapter on applying probability to phenomena too hard to calculate directly, he writes that probability could also be used to measure curves or work out areas. And he adds at once that, no doubt, geometers will not use this method. But it gives him a chance to discuss a particular kind of chance combination.

The set-up is Buffon’s in other words. A plane divided by parallel lines a distance a apart, and a very thin cylinder, in other words a needle, of length 2r, equal to or less than a. What is the probability that, when thrown, it touches one of the lines?

Laplace’s answer is 4r divided by a times pi. Written with the needle’s length, which is 2r, it becomes: twice the needle’s length, divided by pi times the gap.

More games in the same chapter

The needle isn’t alone in Laplace’s book. Just before it, he writes that probability compared with many experiments can reveal the advantage or disadvantage of players when the case is too complicated to calculate directly. He gives two examples: the advantage of being the dealer’s opponent, the hand, in the game of piquet, and the chances of each face of a rectangular prism with unequal length, width and height coming up when it is thrown onto a table.

Earlier still he argues that the same idea works for medicine, political economy and even moral causes, because their effect, repeated many times, shows as much regularity as that of physical causes.

After the needle, Laplace extends the problem just as Buffon did: he adds perpendicular lines to make a floor of rectangles and works out the chance that the needle touches some edge.

Solving for pi by throwing

Here comes the idea that made the problem famous. Laplace writes that if you throw the cylinder a great many times, the ratio between the number of times it touches a line and the total number of throws will come very close to that probability. And then you will know the value of the circumference, that is, of pi.

Laplace adds two more things. That with his tools one can calculate the probability that the error of this estimate stays within given limits. And that, for a given number of throws, the error is smallest when the needle is exactly as long as the gap between lines.

My own calculation from Laplace’s formula: with a needle as long as the gap, the probability of crossing is 2 divided by pi, about 0.64. For the probability to be exactly one half, the needle has to be pi quarters of the gap, about 0.785 times. Buffon rounded that to three quarters. In other words, Buffon’s figure and Laplace’s formula fit together.

We tried it

My own calculation, with a computer simulation of virtual throws using a needle as long as the gap between lines. With 100 throws it came out at 2.99. With 1,000, 3.25. With 10,000, 3.12. With 100,000, 3.13. And with a million, 3.139.

You can see the problem Laplace sensed. To nail two decimal places you need a huge number of throws, and progress is slow: going from 10,000 to a million throws, a hundred times more, only improved the second decimal. There’s also a funny catch in the simulation: to pick the needle’s angle at random, the computer already uses pi. With real matches on a real floor, that doesn’t happen.

Why pi shows up

My own reading, which is reasoning from Buffon’s and Laplace’s texts: pi appears because the needle can land at any angle. All its possible orientations form a circle around its centre, and as soon as you put a circle into a calculation, pi sneaks in. Buffon made this visible with his quarter circle. Laplace, with the circle each end of the cylinder traces as it turns.

That’s why the franc-carreau coin and the needle are cousin problems. In both, the answer depends on a relation between straight lines and circles.

What’s left

My own reading, which is reasoning from the sources: Buffon wanted to know who would win a bet, and Laplace wanted to show how far the calculus of probabilities could reach. Neither meant anyone to calculate pi by throwing needles, and Laplace put that in writing. But the idea of using chance to measure something that isn’t random has stuck. And the floorboards are still there, in case you fancy trying with a box of matches.

More in Math Facts