# Q&A: How Pi is Calculated

Question: How do scientists calculate Pi? I know it’s the ratio of a circle’s circumference to its diameter, but I also know that 22 divided by 7 is not the exact answer. If we’re sending a spacecraft to a location billions of miles away, I’m thinking “very close” could send Voyager off course. — BF, Phoenix, AZ

Answer: That’s a great question. Kinda peripheral to the usual content of Sky Lights, which normally focuses on “things you see in the sky” but I’ve done posts on Why Fireflies Synchronize and How Altimeters Measure Altitude so this is not without precedent. And the fact is: The number π is central to almost all calculations in space science, astronautics, and astronomy. So for this post’s graphic, I set the first 1000 digits of π against a starry background. Anyway, here’s how they calculate π …

First, it’s not so much scientists who calculate π — these days it’s done by mathematicians with the help of computer programmers. Using an arcane branch of mathematics called Number Theory it is possible to prove that π is equal to any of several infinite series expressions. The example below is one of the simpler to parse:

You can find several more infinite series expressions for π on this page. All of them show remarkably interesting patterns and symmetries — almost paradoxical when you consider that π itself appears to be a completely random string of digits. How a mathematician proves a given expression is equal to π is beyond my grasp. How they even devise such an expression is a total mystery.

If you compute only the terms in the expression above you get π = 3.3396825396 … (be careful with the alternating ± signs). Obviously this is not very close to π. It diverges from the true value first digit after the decimal point. But by the time you get to the 300th term in the series the total will be π = 3.14 before it diverges. To get the first 100 decimal places of π you’d need to sum about 1050 terms! This expression is what mathematicians would call an “inefficient algorithm for computation” — whether you’re computing by hand or by machine. Fortunately there are other expressions that converge much more rapidly, but they’re a bit more complex to follow without learning some advanced math. If you’d like to see the one that just broke the record go here.

So in practice what they do is program a computer to calculate one of those expressions using a looping function that keeps adding more and more decimal places until they have the number of digits they seek. In November 2016 the record for the greatest number of digits calculated was broken (again) with a computation of 22,459,157,718,361 digits! If you calculated the circumference of the Universe using only the first 30 digits of π, you’d get a correct value to about the diameter of an atom. Why then, you might well ask, would anyone would want to know π to so many more digits?

The transcendental numbers are a subset of the real numbers. The most well known of these is π. Simple fractions like 22/7 or (the slightly more accurate) 355/113 can get you close to π but never exactly. Fractions are rational numbers (one whole number divided by another), and when you calculate their decimal expansion you either reach zero at some point (try 1/50) or it starts repeating the same series over and over again (try 1/17). The decimal expression for π does neither.

The only reason for calculating π to such massive numbers of digits is the pure curiosity of number theorists. They’d like to see if, for example, all the digits 0–9 appear with equal frequency. This would be the case for a truly random sequence of digits, but no mathematician has yet proved that hypothesis either way. If you run an analysis of the recent record set of digits, all the digits come up the same number of times (to an accuracy of 0.001%).

By the way, we recently celebrated Pi Day, so Happy 3/14 and thanks for the interesting question.

Next Week in Sky Lights ⇒ An Unusual Rainbow