Skip to main content

Pi Toss

Science Snack
Pi Toss
Randomly toss some toothpicks, with pi as your reward.
Pi Toss
Randomly toss some toothpicks, with pi as your reward.

Asked to get an estimate for the famed mathematical constant pi (π), you might do what the ancient Greeks did: Divide the circumference of a circle by its diameter. Here you can estimate pi by a less conventional method: the random tossing of toothpicks.

Video Demonstration
Pi Toss - Science Snack Activity
Tools and Materials
  • Paper
  • Ruler
  • Pencil
  • Toothpicks
  • Optional: protractor, graph paper

Draw two parallel lines on your paper. Make sure the distance between the lines is exactly equal to twice the length of your toothpicks (click to enlarge the photo below).

To Do and Notice

One by one, randomly toss toothpicks onto the lined paper. Keep tossing until you’re out of toothpicks—or tired of tossing (see photo below).

Count the total number of toothpicks you tossed. Also count the number of toothpicks that touch or cross one of your lines. Do not count any toothpicks that missed the paper or poked out beyond the paper’s edge.

Divide the total number of toothpicks you threw by the number that touched a line.

This is your approximation of pi, or 3.14. How close did you come?

What's Going On?

Depending on how many toothpicks you tossed, your approximation of pi may or may not be impressively close. But if you had the patience to toss toothpicks all day—or all week—and then averaged your results, you’d get an increasingly accurate estimate.

This surprising method of calculating pi, known as Buffon’s Needle, was first discovered in the late 18th century by French naturalist Georges-Louis Leclerc, Comte de Buffon. Count Buffon was inspired by a then-popular game of chance that involved tossing a coin onto a tiled floor and betting on whether it would land entirely within one of the tiles.

The method can work on any lined surface (hardwood floors are handy) as long as the separation between the lines is greater than the length of the object thrown. A general expression of the approximation is below (click here for an image):

$$\pi = 2 \times\frac{\text{length of toothpick}}{\text{distance between two lines}}\times\frac{\text{total number of toothpicks tossed}}{\text{number of line-crossing toothpicks}}$$

In this Snack, we made the distance between the lines two times the length of a toothpick so we could just divide the total number of toothpicks tossed by the number that touched a line.

The proof of why this works involves a bit of meaty math, and makes a delightful diversion for those so inclined (see the Math Root below). In general, this experiment in geometric probability is an example of a Monte Carlo method, in which a random sampling of a system yields an approximate solution.

Going Further

You can get a better understanding of why this works using a graphical approach. The position of each toothpick can be described using just two coordinates: x, the distance from the farthest edge of a toothpick with length L to the nearest line, and θ, the angle (in radians) between the toothpick and the line (click to enlarge the figure below).

angles and coordinates

The symmetry of the problem allows us to only consider values of x between 0 and 2L, and values of θ between 0 and π/2. Notice that the coordinates that result in a toothpick crossing a line are those for which x is less than Lsinθ (click to enlarge the figure below).

angles and coordinates

Using a graph with θ on the vertical axis and x on the horizontal axis, plot the points for which there is a line crossing. As you add points, you’ll start to see a pattern (click to enlarge the photo below).

results plotted on a graph

Divide the total area of possible toothpick positions, >2L * π/2, by the area taken up by the plotted line crossings. Once again, you’ll find you get a number roughly equal to pi.

Math Root

Geometrically, we can see that the toothpick will hit the line if 0 < x < Lsinθ for the angles 0 < θ < π/2 (click to enlarge the figure below).

lines and angles

Using calculus, we can integrate to find the area of the solutions that cross, and divide by the total area of possible solutions to find the probability of having a toothpick cross a line (see equation below or click here for an image).

$$\frac{\text { solutions that hit a line }}{\text { all possible solutions }}=$$

$$\frac{\int_0^{\frac{\pi}{2}} L \sin \theta d \theta}{2 L \frac{\pi}{2}}=\frac{-\left.L \cos \theta\right|_0 ^{\frac{\pi}{2}}}{L \pi}=\frac{-L\left(\cos \frac{\pi}{2}-\cos 0\right)}{L \pi}=\frac{-L(0-1)}{L \pi}=\frac{1}{\pi}$$