February 23, 2006

Pi the way

The little mark on big bro's slide rule always fascinated me. I had learned about pi in school. I knew nobody knew its exact value. Yet, here it was between "3" and "4" on the slide rule, a little line with the Greek letter pi under it. If nobody knew its value, how did the slide rule maker know where to put the mark?

Just by thinking that, I had unwittingly joined the ranks of people all through history who have been puzzled, infuriated or just fascinated by pi. (Some even say that the history of pi is the history of man).

So what is this little number anyway? No more, and no less, than the ratio of a circle's circumference to its diameter. Simple. Imagine, if you like, a prehistoric man idly drawing a circle in the sand. Perhaps he wonders what makes it so regular, so symmetric. At some point, he measures its diameter and its circumference, and stumbles on a ratio of about 3.

About, but not exactly.

People came up with better ways to calculate the ratio more accurately. But something was always lacking: nobody could find an exact value. In Babylon, they used the value 3 1/8, while in about 499 AD, the great Indian mathematician Aryabhata wrote this in his Aryabhatiya:
    Add 4 to 100, multiply by 8, and add 62,000. The result is approximately the circumference of a circle of which the diameter is 20,000. [Italics mine]
Aryabhata did not tell us how he arrived at this calculation, but it gives us a value of 3.1416. Pretty accurate. Note that this kind of accuracy, achieved by the 5th Century AD, is more than enough to place a mark on a slide rule. So much for my wonder at how the slide rule maker knew where to put his mark.

But from the time of Archimedes -- about the third Century BC -- onwards, the accuracy to which pi could be calculated was "purely a matter of computational ability and perseverance", says Petr Beckmann in his delightful A History of Pi. So simply calculating pi isn't a particularly interesting exercise.

But Archimedes was a great champion of method, and that's the truly interesting thing about the history of pi. Typical of the man, he found a method to calculate pi to any desired degree of accuracy. Later mathematicians used his method to find closer approximations to pi than Archimedes ever did, but get this: it was 19 centuries before a completely new approach to the problem was found.

That was in 1671, when the Scottish mathematician James Gregory found this
"infinite series":
    pi = 4 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11 ...
This is an infinite series in that it does not end. But the more terms you add up, the closer you get to the value of pi. Try it.

Gregory's series is interesting for being simple, and as a pointer to a whole new way to calculate pi. But it is itself nearly useless for such calculation, as you may have found out. The problem is that it converges far too slowly. Just two decimal place accuracy -- achieved by Archimedes 2000 years before, and surpassed by Aryabhata among many others by the 5th Century -- needs over 300 (!) terms of Gregory's series.

But Gregory had opened serious floodgates. Following in his footsteps was a giant: Isaac Newton. While calculating something else, he tossed out a series for pi that was a bullet train to Gregory's bullock-cart. In just 22 terms, he had pi correct to 16 decimal places. And this, wrote Newton, was "by the way": a fringe benefit from his other work. But as Beckmann points out, even "the crumbs dropped by giants are big boulders."

Leonhard Euler, whom some call the greatest mathematician of all time, churned out formulae for pi almost routinely. Once, he used one of them to calculate pi to 20 decimal places in just an hour. When you remember that Euler's only tools were pen, paper and his remarkable mind, you get an idea of that mind.

Today of course, with plenty of computing power, such feats are easy. Hell, I can't resist: you might say, as easy as 3.1415926535897932384626433832795028841971693993751058209749445923078164 ...


km said...

Down with 3.14, up with 1.618!!!

Your math-related posts are always fun.

Pareshaan said...

Very nice post Sir. On the more frivolous side though, have you seen the film "Pi" - pretty cool.

J. Alfred Prufrock said...

With great scientists and such-like brains, my attitude is the same as towards, say, Olympic gymnasts. I admire their achievements with a sort of incomprehension. (There's a post in there)

Do you know the story of Johannes Bernoulli and 'the claw of the lion'?


Kartik said...

Very interesting post. Have been meaning to read "The History of Pi" ever since my Calculus prof dropped a hint that many of us would do far worse in life than read it -

Definitely agree about Euler.

Dilip D'Souza said...

Thanks y'all! km, perhaps a post about 1.618 one of these days ... why not?

traveller, I graduated in electronics and electrical engineering (EEE) at Pilani. But I admit that somewhat shamefacedly, because in not one of my EEE courses did I get above a "C". Though I did go on to a MS in CS, where I did a little better.

Pareshaan, film "Pi" -- nope! Whassitabout?

JAP, nice to see you hereabouts! The lion's claw (sometimes related as lion's paw) is a delightful story! (I'll leave you others to find it, I'll just spoil the story if I try to tell it). Newton was often referred to in terms like those.

Kraktik, your Calculus prof was right! Go do it.

Anonymous said...

Nice post, Dilip.

Nilakantha Somayaji, in his extensive commentary to the Aryabhatiya added that the value of Pi can never be computed accurately, it can only be approximated.

Anonymous said...

You completely missed an important new addition to the history of Pi. Madhava http://en.wikipedia.org/wiki/Madhava_(mathematician)

His works were only recently discovered as late as 1975 and by all means it appears that he had invented some form of calculus 400 years before Newton and Leibnitz.

Vikrum said...


Definitely see the movie "Pi." It's fantastic.

Suhail said...

Sirjee, this was excellent! More of this math-themed posts.

Raj said...

Great stuff, Dilip.