Pi () is one of the most iconic numbers in mathematics. It shows up everywhere — circles, spirals, ocean waves, even quantum mechanics.
We probably remember from high school that is the ratio between a circle’s circumference and its diameter:
We also remember its approximate value, 3.14 — but have you ever wondered how we actually arrive at that number?
Well, the ancient Greek mathematician Archimedes famously used polygons inside and outside a circle. The more sides the polygon has, the closer its perimeter gets to the circle’s circumference.
He established bounds equivalent to:
To get better accuracy, you need more sides. But as you add more, the improvements get smaller and smaller — which is why computers today rely on more efficient formulas to calculate trillions of digits of .
But don’t worry — we won’t be diving into complex geometry or calculus today. Instead, we’ll use something surprisingly simple yet fascinating: randomness.
Sounds intriguing? Let’s dive in!
The Monte Carlo Method
The Monte Carlo method is a class of algorithms that rely on repeated random sampling to obtain numerical results. It was invented by Stanisław Ulam, a Polish-American mathematician — reportedly while he was thinking about the odds of winning a game of solitaire, and realized random sampling could crack problems that were too messy to solve with exact math.
And yes, the method’s name comes from the Monte Carlo Casino in Monaco, reflecting the role of chance in the process. 🎲
Here’s how we can use the Monte Carlo method to estimate :
Imagine a square with a side of length :
Now imagine a circle with radius , perfectly inscribed inside that square — touching all four sides.
We know that:
- The area of the square is .
- The area of the circle is .
Finally, imagine scattering random points inside the square. Some will land inside the circle, some outside it:
What’s the probability that a point lands inside the circle? It’s simply the ratio of the circle’s area to the square’s area, which works out to .
If we’re placing the points randomly, then the fraction of points landing inside the circle should, over time, get closer and closer to :
By counting how many points land inside the circle and dividing by the total number of points, we get an estimate of that probability. Multiply by 4, and voilà — an estimate of :
This works thanks to the law of large numbers, which says that the more random data we collect, the closer our results get to the true expected value.
So if we throw down enough random points, we land on a decent approximation of — no complex calculations required.
Try It Yourself
What I really like about this experiment is that it doesn’t have to stay a computer simulation — we can bring it into the real world. All you need is:
- A square sheet of paper
- A circle drawn inside it, touching all four sides
- Small objects to toss — beans, bits of paper, paperclips, whatever’s on your desk
People have gotten creative with this too — some have thrown actual darts at a target instead.
Final Thoughts
There’s something wonderfully strange about pinning down a number as precise and mysterious as using nothing but chance. While this method isn’t the most efficient (you’d need millions/billions of tosses for higher precision), it’s a fun and intuitive introduction to the Monte Carlo method.
