Drop Buffon's Needle on the floor a thousand times and estimate pi

It's Pi Day. Don't prick your finger, it's mathemagic!

Spread the knowledge

The head of a sewing needle with red and yellow thread threaded through it.

Photo by amirali mirhashemian on Unsplash

Philosophers and researchers have long searched for estimates of pi, from approximations using the golden ratio to the famous fraction 22/7. One such estimate was accidentally discovered by French mathematician Georges-Louis Leclerc, Comte de Buffon – Buffon for short. He asked a simple question: Suppose a needle of a particular length is dropped onto a wooden floor with evenly spaced boards of the same width. What is the chance that the needle crosses a crack between the boards? 

wood boards

A needle in a pi-stack

Tim Mossholder

The angle of the needle determines how likely it is to have crossed the crack: with a smaller angle between the needle and the cracks, it is easier for the needle to land without crossing one. So, the solution to the “Needle Problem” relates the sine function to the needle’s angle, drawing a curve where the needle will always cross the crack. The area under this curve is compared to the rest of the area the needle could have landed, estimating the chance the needle crossed a crack. The resulting ratio relates the length of the needle, the distance between the needle and the crack, and pi – a simple shuffling of variables yields an estimate of pi.

Now, if you were to drop a needle on a wooden floor yourself, it would take you thousands of attempts before you could reasonably calculate pi. That's because the ratio mentioned above is in the case of infinite attempts – in the real world, we are limited to the number of times we can drop a needle. Researchers at the University of Illinois – Urbana-Champaign developed a simulation to virtually drop needles and estimate pi. On this Pi Day, try it out to see how close you can get to pi using Buffon’s Needle.