How to find pi in randomness all around you
March 12, 2026 5 min read Add Us On Google Add SciAm How to find pi in randomness all around you Random coin flips, floppy needles and mathematical mysteries reveal pi in new ways By Emma R. Hasson edited by Sarah Lewin Frasier These three techniques will let you estimate pi out of randomness. Jonathan Mauer/Getty Images Celebrate Pi Day and read all about how this number pops up across math and science on our special Pi Day page . Grab something circular, like a cup, measure the distance around the circle, and divide that by the distance across the widest part. What you’ll get is a pretty good estimate of the irrational number pi (3.14159...). But you can also find pi in a series of random coin flips or a collection of needles tossed on a wooden floor. Sometimes the reason pi shows up in randomly generated values is obvious—if there are circles or angles involved, pi is your guy. But sometimes the circle is cleverly hidden, and sometimes the reason pi pops up is a mathematical mystery! To celebrate Pi Day this year, here are three ways to estimate pi using random chance that you can try out at home. The last one, using coin flips, is brand new—published just in time for Pi Day. On supporting science journalism If you're enjoying this article, consider supporting our award-winning journalism by subscribing . By purchasing a subscription you are helping to ensure the future of impactful stories about the discoveries and ideas shaping our world today. 1. Circle in a square Perhaps the simplest way to randomly estimate pi works like this: take a square with side length 2 and place a circle with radius 1 inside so that it just touches the edges of the square. Then randomly generate points in the square. As you add more and more random points, the proportion of points which end up in the circle will approach π ⁄ 4 —the ratio between the area of the circle (pi) and the area of the square (4). The incidence of pi here is not surprising—it comes directly from the formula for the area of a circle—but the method is a classic example of a Monte Carlo simulation, in which random data are used to approximate an exact calculation. Amanda Montañez 2. Buffon’s Noodle Suppose I drop a bunch of needles on a hardwood floor with lines spaced one needle length apart. What proportion of the needles can I expect to cross the lines? This question was first posed by Georges-Louis Leclerc, Comte de Buffon (or Count of Buffon) in 1733, and the answer is 2 ⁄ π (about 2 ⁄ 3 ). To find out why, we need to think about a more general question: What if our needle is not a straight line but a squiggle, a square or any other line-drawn shape? This extended version of the problem is sometimes called “Buffon’s noodle” because noodles come in many more shapes than needles. It turns out that no matter what shape the needle is bent into, we can still expect it, on average, to cross the same number of lines. The expected value of the number of lines crossed is proportional to the length of the needle. In other words, we can expect a collection of needles of length n (of any shape) to cross n times as many lines as the same number of needles of length 1. So to find the answer to Buffon’s query, all you need to do is pick a clever shape for your needles. This is where the circles come in. If you have lines spaced one unit apart and a needle bent into a circle that has diameter 1, it will always cross the lines exactly twice. The length of the needle making up the circle is pi, and so the probability that a needle of length 1 will cross a line will be the expected value of the number of times the circle crosses—2—divided by the length of the circular needle, giving us 2 ⁄ π . Amanda Montañez 3. Flipping coins Pick up a coin and flip it. Record heads or tails. Repeat until you’ve gotten one more head than tails, and record the proportion of heads to total flips. For example, if your first flip was heads, stop right away and record 1. If you flip tails, heads, tails, heads, heads, stop and record ⅗. The expected value of your result, or the average of all your trials if you did infinitely many, is π ⁄ 4 . The more trials you average together, the closer you get to π ⁄ 4 . This new method for estimating pi using coin flips was introduced by James Propp, a mathematician at University of Massachusetts Lowell, in a preprint posted online at ArXiv.org last month—just in time for Pi Day! Though the math behind the method is nothing new, the idea to use it to estimate pi with coin flips is. So why do we get π ⁄ 4 ? The unsatisfying answer is that somewhere in the probability calculation there is an infinite sum that happens to correspond to the values of the arcsin function—a trigonometric function closely related to pi. But mathematicians haven’t found a meaningful connecti