Buffon’s Needle: Estimating π with Randomness

Mathematics often feels precise and deterministic. We solve equations, follow logical steps, and do our best to arrive at exact answers. But sometimes, surprisingly, randomness can also lead us to deep mathematical truths. One of the most famous examples of this idea is a problem from the 18th century known as Buffon’s Needle.

Imagine you have a floor made of long wooden planks placed side by side. The seams between the planks form a set of equally spaced parallel lines across the floor. Now, suppose you take a needle and randomly drop it onto the floor. Sometimes the needle lands entirely on one plank. Other times, it crosses one of the seams between planks, as shown below.

Now here is the curious question posed by the French mathematician Georges-Louis Leclerc, Comte de Buffon in the 1700s:

If we repeatedly drop the needle at random, what is the probability that it crosses one of the lines on the floor?

At first glance, this sounds like a simple probability puzzle. But the answer turns out to involve one of the most famous numbers in mathematics: π.

The Setup

To keep things simple, assume the distance between the parallel lines on the floor is the same as the length of the needle. We can also imagine that all of our needles are thrown onto the same plank, potentially crossing onto the plank above or below. This configuration is equivalent to throwing the needle onto any plank as long as the planks are equally wide; this modification makes the analysis much simpler.

Every time the needle lands, two things determine whether it crosses a line:

  • The distance x from the center of the needle to the nearest line
  • The angle θ at which the needle lands with respect to the parallel lines

See a depiction of this below.

To determine the probability of a needle crossing one of these lines, we need to describe what a "random drop" of the needle means mathematically. If the lines are the same length apart as the length of the needle L, then the center of the needle can never be farther than L/2 from the nearest line. Therefore, 0 ≤ x ≤ L/2. Next, we can simplify our domain for θ. The problem is symmetric, so we only need to consider angles between 0 and π/2. Any given half of the needle then has a vertical reach of (L/2)sin(θ).

We will say a needle "crosses" a line precisely when the center lands close enough to a line that one end of the needle can reach across the line. This occurs when x ≤ (L/2)sin(θ).

An important assumption to make is that every pair (x,θ) in the rectangle 0 ≤ x ≤L/2, 0 ≤ θ ≤ π/2 is equally likely. We’re assuming the needle lands with uniform randomness over all vertical positions x and angles θ. This means that the probability of crossing a line is the fraction of this region where the inequalities above hold. That is, 

Probability = (area of favourable region) / (area of total region)

The "rectangle" formed by inequalities has a total area of (L/2) * (π/2) = π*L/4. The needle crosses a line exactly when x ≤ (L/2)sin(θ), so for a fixed angle θ, the allowable x values are 0 ≤ x ≤ (L/2)sin(θ). The favourable area is then:

The probability of a needle crossing a line is therefore:

Estimating π

This result leads to a fascinating idea. If the probability of crossing a line is 2/π, we can rearrange the formula to estimate π itself:

π ≈ 2N / C

where:

  • N = the total number of needle drops
  • C = the number of times the needle crosses a line

In other words, by performing a simple random experiment and counting how often the needle crosses a line, we can approximate π.

For example, suppose you drop the needle 10,000 times and it crosses a line 6,366 times. Plugging these values into the formula gives

π ≈ (2 × 10,000) / 6,366 ≈ 3.14

With enough trials, the estimate tends to get closer and closer to the true value of π. At the bottom of this post, I attached a Maple worksheet that simulates this phenomenon. Below are results from simulating this result using N = 10, 100 & 1000, respectively. Notice as N increases, our approximation for π tends to become more and more accurate.

Below is a more dynamic simulation from the Maple worksheet to show how the approximation stabilizes as N increases.

Why This Is So Remarkable

What makes Buffon’s Needle so fascinating is the unexpected connection between geometry, probability, and one of mathematics’ most important constants.

π usually appears when dealing with circles (circumference, area, rotation, etc). But in Buffon’s experiment, there are no circles at all. Instead, π emerges from the geometry of all the possible ways a needle can land on a set of parallel lines.

This was one of the earliest examples of what we now call a Monte Carlo method, which is essentially using random experiments to estimate numerical values. Today, similar techniques are used in physics, finance, computer graphics, and machine learning.

A Mathematical Experiment You Can Do Yourself

One of the best parts of Buffon’s Needle is that you can try it yourself. All you need is:

  • A toothpick or needle
  • A piece of paper with a sequence of parallel lines, each a distance of the needle's length apart
  • A lot of patience

Drop the needle repeatedly (N times), record how many times it crosses a line (C), and compute 2N/C. The more times you repeat the experiment, the closer your estimate will get to π.

After reading about this experiment, I was convinced that mathematics is not only about abstract symbols and formulas. Sometimes, even something as simple as dropping a needle onto the floor can reveal the hidden structure of elements of the universe that we would've otherwise never known were there.

 

Buffons_Needle_Simulation.mw

Please Wait...