Even computers can’t get pi exactly right

You’ve probably heard of “pi day”, informally celebrated in several countries on March 14. That’s because writing this date as 3/14 brings to mind the first three digits of π (pronounced pi).

Pi is famous as the mysterious number that relates the radius of a circle to its circumference and area, even though π itself slips through our fingers as soon as we try to pin it down. My basic scientific calculator has 3.141592653 as its inbuilt value for π. Computers offer much more precision, with trillions more decimal places, but even these are approximations.

That’s because π is an irrational number: it cannot be expressed as a fraction – as a ratio of whole numbers – and this means it doesn’t have a finite decimal form, or even an infinitely repeating one such as 0.33333… (= 1/3). The idea that you need a seemingly random infinite string of digits to “calculate” a tangible, finite circumference or area is strange, to say the least!

Infinity is an awesome concept that we can never quite grasp, so it’s no wonder that π has such a tantalising imaginative pull.

But there’s even more to the significance of March 14, because it is also Albert Einstein’s birthday. Einstein’s mathematical insight led to a revolution in our understanding of reality, and ultimately to one of the greatest recent discoveries in science: gravity waves.

So it’s a special day indeed for mathematicians, and late last year UNESCO voted to declare it the official International Day of Mathematics (IDM).

There’ll be various educational and public celebrations around the world, and you can find details on the IDM website.

The theme this year is “Mathematics is Everywhere” – from modelling economic and social systems, to the maths underlying the GPS, MRI and CT scans, AI, cosmology, and much, much more.

But here I want to celebrate this theme in a different way, by offering a peek at the amazing multicultural history of the mathematics underlying your computer’s estimates of. This history also reveals that π itself is “everywhere”, not just in the geometry of simple circles.

First, a brief shout out to the ancient peoples who experimented with strings and sticks to work out the ratio of a circle’s circumference to its diameter. Remarkably, they found that no matter what size the circle, this ratio is always around three.

By approximating circles with straight-line segments, various early mathematicians around the world – from ancient Greece to mediaeval China, India and the Middle East – used repeated applications of Pythagoras’s theorem to work out better and better values, beginning with Archimedes’s 22/7, which many of us learned at school. If you divide 22 by 7 by hand, you get the repeating decimal 3.142857142857142857…

It’s a little high compared with the current value – 3.141592653589793238462643383279502… plus another 22 trillion digits and counting – but it’s a pretty good effort for someone working by hand more than 2000 years ago.

But how do you program a modern computer to calculate increasingly accurate values of π? And how do you know that even the best computer will never quite nail it? The answers arise from the curiosity of earlier mathematicians who wanted to understand the deeper nature of this mysterious number, just for its own sake. 

Two key things jump out on a quick look at this history. First, π is related to the ancient subject of trigonometry – to sines and cosines, which are defined with respect to the angles and radii of circles.

You may also remember from high school that angular measures can be in degrees or radians, and there are 2π radians in a circle, and 360 degrees; so, for example, 45 degrees is equivalent to π/4 radians. A handy result, as we’ll see, is that tan π/4 = 1.

Second, π is also somehow related to integral calculus, and to infinite series, because that is how mathematicians managed to estimate the area under curved lines such as circles.

For instance, imagine the area enclosed by a semi-circle and its diameter. The ancients knew (in effect) that this is half of πr2, where r is the radius, so to get a handle on π you need to work out the answer in a different way. The idea is to fill up the area as closely as possible with a series of thin rectangles. Now multiply length by width to get the area of each rectangle, and add up the results.

Today’s calculus students will recognise this as the technique underlying integration, but the basic idea had been known to Archimedes, and to mediaeval mathematicians in India and Europe, before Newton and Leibniz generalized the process in the late seventeenth century.

Anyway, the point is that the skinnier these rectangles are, the better the approximation to the area – and the skinner they are, the more rectangles you need to fill the space. So, it seems that to get an exact approximation to the area under the semi-circle you’d need an infinite number of infinitesimally thin rectangles. Infinity again!

Mathematicians experimented with this method for finding the areas enclosed by various curves, but to see its relation to the infinite digits in , it helps to look at one of the most amazing results in the history of early modern mathematics.

It uses the function 1/(1 + x2), and you can see the hidden infinity here by doing a simple long division: you get 1 – xx– x6 +…, where the pattern goes on forever. The area under this function (that is, its integral) is equal to x – x3/3 + x5/5 – x7/7 +…,  which, in turn, equals the trigonometric function y=tan-1x (which just means that tan y = x).

This result is relatively easy to find with calculus, but the amazing thing is that it was first discovered around 1500 by now-unknown Indian mathematicians, and independently rediscovered more than 150 years later by Newton, Leibniz, and James Gregory, just before the methods of calculus became formalised.

It didn’t take long for these mathematicians to realise that this result gives an infinite series for π. As I mentioned, y = tan-1 x means that tan y = x, so if y = π/4, then x = 1.

Putting this into y = x – x3/3 + x5/5 – x7/7 + … gives π/4 = 1 – 1/3 + 1/5 – 1/7 + …, where the pattern goes on forever. This is why a calculator can use a series like this to calculate π to trillions of decimal places, yet never actually reach an exact value.

There are other, more efficient mathematical techniques for computing π, but this one is the oldest and simplest. Nevertheless, the irrationality of this intriguing number wasn’t formally proved until 1761.

But π soon broke out of the realm of pure mathematics and began cropping up in physics, too. It’s especially important in representing cycles, such as waves – after all, the graphs of the basic trigonometric functions sin x and cos x have a wavy shape, with a period of 2π.

We now know there’s a range of waves in nature, from water waves and vibrating strings to electromagnetic and gravitational waves, and even, at the quantum level, matter waves.

Not surprisingly, then, π appears in many of the fundamental equations of physics, including Schrödinger’s wave equationMaxwell’s equations of electromagnetism, the Gaussian “field” form of Newton’s equation of gravity, and Einstein’s equations of general relativity.

Which brings me back to March 14: Einstein’s birthday, Pi Day, and now the International Day of Mathematics. So, here’s to maths, in all its glorious forms!

Please login to favourite this article.