Pi Day 2021 - Give Me Pi!
Written by Mike James   
Sunday, 14 March 2021

On this Pi Day I give you the search for Pi. No, not its numbers but what it means to computer science, which is a little different from what it means for mathematics. It's a matter of symbols, not numbers.


Credit: V.Hart

If you want to know more about the ideas connected with Pi, and the explanation of why March 14th every year is Pi Day, then see some of the related articles listed below where I have explained some of the strangeness of this number. This time I want to point out that you really don't know Pi.

So I was typing in a formula and someone looking over my shoulder said "Pi!", in an effort, my guess, to prove that they were mathematically literate. My response was possibly rude but accurate - "Not really".

What did I mean?

I had typed 3.14 and while this is often recognized as Pi it very much isn't. It's a good approximation to Pi, but as you probably already know Pi is an irrational transcendental. The irrational part obviously doesn't mean that it's not logical, it's a more fundamental meaning of the term that expresses the idea that Pi is not the ratio of two whole numbers. Yes that's right, even if I had written 22/7, or some other fraction claiming to be Pi, I would be entitled to the same rude response. There is no fraction that you can create that is Pi. There is no whole number a or b such that a/b is Pi. Pi is irrational.

This sounds innocent until you start to think about its implications. There is a sense in which the only really sophisticated numbers we can write down are ratios. You can write down numbers like 3, 7 and so on - these are the integers from which all else is created. Once you try to move beyond the integers you have the rationals that you can write down - things like 3/4 and 4/7 and so on. Clearly you can write down any rational number - it's easy. But now consider an irrational number, how do you write it down? Well, not in the form a/b, but what other way can you write a number? This is a problem that worried mathematicians for years and probably still does.

You might think that you can write an irrational down as a decimal, or some other base fraction, but consider what a fraction like  3.14 means. It is the same as 3+1/10+4/100 or 314/100. Any decimal you write down is just a fraction wearing another skin.

The solution, if you accept it as such, is that to write down an irrational you need to write an infinity long decimal. Some rationals give rise to such infinite decimals. For example, consider 1/3 in decimal that's 0.333333... where ... means keep going. Rational numbers either give a finite decimal expansion or one that eventually repeats like the 33333... And the argument goes the other way - any infinite decimal that eventually falls into a repeating pattern of digits is a rational number. But what what this means is that any irrational number is an infinite decimal fraction that never ever falls into a repeating pattern.

That is, you cannot ever say that root two is some long string of numbers followed by a set of digits that repeats. It has to go on and on, never falling into a repeat.

Notice that it is the repeat that makes it possible to write the number down. When you write 0.33... then this allows someone to say "That's one third" and I would respond with "Yes it is - exactly one third". The notation of three dots means you have reduced the nonessential infinity of the recurring decimal into something finite.

Now this idea that an irrational number cannot settle into a repeated pattern is stranger than you might expect. For example how do you write down the square root of 2? You could make a stab at it with 1.41 but that's not the square root you seek. What about 1.414? No still not... and so on. Put simply, you cannot write it down at all. You can write down a rational number that gets as close as you like, but you can never ever write down an irrational number. So if you looked over my shoulder and said "that's the square root of 2!" I would still counter with "Not really."

But there is even more to this...

The transcendental part of Pi's description is more difficult to understand and probably accounts for why so many non-mathematics-types think Pi is special. Pi is special, but not because it has anything to do with meditation or pyramidal healing. Numbers that we mostly work with are "algebraic" in the sense that if I give you a number you can find an equation that specifies it. The equation is the number's definition if you like. For example, the square root of 2 is irrational like Pi but it is algebraic and an equation that defines it is r= 2. That is, the square root of 2 is a number that when you square it you get 2... obvious and logical. However, Pi is not like this. There is no reasonable equation that "defines" Pi and this is what "transcendental" means and when you think about it for a while it is every bit as "trippy" as the more common meaning of the word.

To be clear, you can't write down an irrational number because you can't ever finish writing down an infinite sequence of digits that doesn't eventually repeat. However, for the square root of 2 you can write something finite that defines it - r= 2 - and this makes an algebraic number very different from a transcendental. It means that you can reason about it as its properties are the properties of the equation that defines it. For example, if I ask you to work out t = 3 times √2, it's easy as the equation that defines the square root of 2 gives an equation in which t involves t, i.e. (t/3)= 2 which, after some simplification, gives t2=2*9=18 and so we now know that t is the square root of 18.

Irrational algebraic numbers are not scary because we can work with them as if their defining equations were a way of writing the number down using a finite number of symbols. You can consider algebraic numbers as having finite representations because of their finite defining equations.

The transcendentals are not so nice. As they don't satisfy any reasonable equation, they are not so easy to pin down. Most of the transcendental are so wild that they don't have finite representations or properties that make it possible for us to work with them. Pi is special in that it has defining equations, albeit with an infinite number of terms, that have patterns that make it possible to work with the number in a way that is closer to the way we work with algebraics. 

Transcendentals don't have equations that define them. To make this definition work we have to say what sort of equations. Given we can only work with algebraic numbers, it makes sense to keep transcendental out of equations that might define transcendental. However, this doesn't mean that relationships between transcendental don't exist, just that they are very difficult to work with. For example, consider the question of whether pi + e, both transcendental, is transcendental. If the answer is that the sum is algebraic we would have a finite equation involving two of the best known transcendentals.

In this discussion I have ignored many of the technical niceties - exactly what equations algebraic numbers satifisy, for example. What is clear from a computer science point of view is that the distinction between rationals, irrationals and transendentals is all about what effective methods of computation they allow. Computing a rational is just a matter of division; irrationals can usually be computed using algorithms that give increasingly accurate values as the computation proceeds. In the main transendentals are difficult to define, let alone compute - Pi and its best friend e are exceptions and Pi is particularly computable. That is why it is an extremely untypical transcendental and why it inspires so much love.

And no this isn't Pi either:


  • Dr Mike James, founder and chief editor of the I Programmer website, is also the author of The Programmer’s Guide To Theory which, as its subtitle "Great ideas explained" suggests, sets out to present the fundamental ideas of computer science in an informal and yet informative way.

More Information


Related Articles

Pi Day 2020 - A Meditation On Numbers

Google Smashes Pi Record For Pi Day

Non-Computable And Other Numbers

It's Pi Day 2018 And Google Gets In On It With A Doodle

Pi Day 2017 - Why Pi?

(Pizza) Pi Day

Happy Pi Day!      

Pi Day Of The Century 

The Life Of Pi - Yes It's Pi Day       

Celebrate Pi Day It Contains All Human Knowledge   

60 trillionth binary digit of pi-squared calculated

Yahoo! Gets to the 2 Quadrillionth bit of Pi - it's zero

Finding Pi

The Programmer's Guide To The Transfinite 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.



Jetpack Compose Improves Performance

Google has released version 1.6 of Jetpack Compose as part of its larger Compose January '24 Bill of Materials release. Google says this release largely focuses on performance improvements, courtesy o [ ... ]

Docker Introduces Build Cloud

Docker is offering a new service, Docker Build Cloud. This is a cloud-based build service that Docker says makes it faster to create builds of Docker images by combining building in the cloud with the [ ... ]

More News



Last Updated ( Sunday, 14 March 2021 )