Calculating Pi: How We Actually Measure the Infinite

Calculating Pi: How We Actually Measure the Infinite

Pi is everywhere. It’s in the curve of your coffee mug, the signal of your smartphone, and the orbit of planets. But if you actually sit down and try calculating pi, you realize it’s a bit of a nightmare. It’s an irrational number. It never ends. It never repeats. You can’t write it as a fraction. Honestly, it’s just a ratio of a circle’s circumference to its diameter, yet it has driven mathematicians literally insane for thousands of years.

People think you need a supercomputer to get it right. You don't. While Google Cloud researchers recently pushed the record to 105 trillion digits using massive clusters of N2 VMs, you can actually get a decent approximation with some yarn and a ruler. Or a few lines of Python. Or even by throwing needles on a floor.

The Old School Way: Archimedes and Polygons

The Greek mathematician Archimedes was basically the first person to get serious about this. Around 250 BCE, he didn't have computers. He didn't even have the digit zero. He used a method called "exhaustion." Imagine a circle. Now, draw a hexagon inside it and a hexagon outside it. You know the perimeter of those hexagons is easier to measure than the circle itself.

Archimedes knew the circle's circumference had to be somewhere between those two perimeters. So, he kept doubling the sides. He went from 6 sides to 12, then 24, then 48, and finally 96. By the time he hit a 96-sided polygon, he figured out that pi was between $3\frac{10}{71}$ and $3\frac{1}{7}$. We still use $22/7$ today for quick math because of him. It's close. It's not perfect, but for building a stone arch in ancient Syracuse? It worked.

The Infinite Series Revolution

Skip ahead a few centuries. We stopped drawing shapes and started using calculus. This is where things get weirdly beautiful. Mathematicians like Gottfried Wilhelm Leibniz and James Gregory discovered that you can calculate pi using a series of fractions.

The Leibniz formula looks like this:
$$\pi = 4 \left( 1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \frac{1}{9} \dots \right)$$

It’s simple. It’s elegant. It’s also incredibly slow. If you want to get 10 decimal places of pi using this formula, you'd have to add up about five billion terms. Nobody has time for that.

Later, an absolute genius named Srinivasa Ramanujan came along. He was self-taught and claimed a goddess gave him formulas in his dreams. His series for pi are terrifying to look at but they converge on the true value incredibly fast. Modern computer algorithms are often just supercharged versions of the logic Ramanujan was scribbling in notebooks in the early 1900s.

How Your Computer Does It Now

If you want to calculate pi on your laptop today, you probably won't use Archimedes' polygons. You’ll use the Chudnovsky algorithm.

🔗 Read more: 3D Porn Almost Real: Why Hyper-Realism Is Changing How We Think About Digital Intimacy

Developed by the Chudnovsky brothers in the late 1980s, this formula is the current king. It’s what Emma Haruka Iwao used at Google to break world records. Every time a new "most digits of pi" headline hits the news, it’s almost certainly thanks to this algorithm. It adds about 14 digits of precision per term.

# A very rough conceptual idea of a pi calculation in Python
import decimal

def calculate_pi(precision):
    decimal.getcontext().prec = precision
    # This is a placeholder for the actual complex Chudnovsky implementation
    # which involves heavy factorial math
    return "3.14159..." 

But why do we do it? Why calculate trillions of digits? NASA only uses about 15 decimal places for interplanetary navigation. Even to describe the observable universe to the precision of a single atom, you only need about 40 digits. Calculating pi to 100 trillion digits isn't about the circle anymore. It's about testing hardware. It’s a "stress test" for supercomputers. If a computer can run for 100 days straight calculating pi without a single bit flipping or the CPU melting, that’s a reliable machine.

The Buffon’s Needle Experiment

You can actually calculate pi using probability. It sounds like a magic trick. It's called Buffon's Needle.

Drop a needle on a floor with parallel lines (like hardwood). If the length of the needle is the same as the distance between the lines, the probability that the needle crosses a line is $2/\pi$.

So, if you drop a needle 1,000 times and count how many times it crosses a line, you can back-calculate pi. It’s a "Monte Carlo" method. It’s messy. You’ll get something like 3.12 or 3.16. But it proves that pi isn't just some abstract math rule; it’s baked into the physical geometry of chance.

What Most People Get Wrong

People often think pi is "solved." It's not. We still don't know if pi is a "normal" number. A normal number is one where every digit (0-9) appears with exactly the same frequency in the infinite string. We think pi is normal. We’ve checked trillions of digits and they look pretty evenly spread out. But we haven't proven it.

There's also the "Tau" debate. Some mathematicians think pi is actually the wrong constant. They argue we should use $\tau$ (tau), which is $2\pi$ (roughly 6.28). They say it makes formulas much cleaner. If you use tau, one full turn around a circle is just $1\tau$ radians instead of $2\pi$. It’s a niche movement, but they have a point.

Actionable Steps for Exploring Pi

If you’re bored and want to see the math in action, try these:

  • The String Test: Find the most perfect circle in your house (a lid or a plate). Measure the circumference with string. Measure the diameter with a ruler. Divide them. See how close you get to 3.14. Usually, human error makes it 3.1 or 3.2.
  • Code it: Open a basic Python environment. Try implementing the Leibniz series. Watch how many iterations it takes just to get 3.141. It’s eye-opening how "weak" some math can be.
  • Visualizing Digits: Use websites like "The Pi Searcher" to find your birthday in the digits of pi. Because it's infinite and seemingly random, your birth date, your phone number, and even the digital code for this entire article are buried somewhere in those digits.

Calculating pi is a bridge between the physical world and the infinite. Whether you're using a polygon or a Chudnovsky series, you're chasing a value that the universe uses as a fundamental building block. Start with $22/7$, but know that the rabbit hole goes much, much deeper.