Skip to main content

Why are you so irrational Mr.Pi?


The story starts almost 4000 years back in the civilization of Babylonia. With civilization, started man's interaction with geometry. There was a need to understand geometry of everyday objects to make life easier. It so happened that the Mathematician or Logician of that period came across an ingenious method for some purpose. But for it to work there was a small hitch which had to be solved. i.e he wanted area.of square some size to be equal to area.of circle some radius. His problem was to find the radius given the side of square or vice versa. Poor guy struggled hard, looking at his struggle others of his era helped him .But none succeeded. Around a century or two later and 3000 km away in Greece this problem was recast by Hippocrates as "Quadrature of Circle" i.e the problem was to construct a circle from a square just by using an unmarked straight edge and a compass. Even he failed. Soon the list of failed got longer and longer, including some great mathematicians. Eventually, it started to become a folk-lore and anyone who tried was ridiculed. The problem even appeared in the great Dante's work- Paradise canto XXXIII lines 133–135:

As the geometer his mind applies
To square the circle, nor for all his wit
Finds the right formula, howe'er he tries

Little did they know that they were fighting for the impossible. In 1882, the task was proven to be impossible, as a consequence of the Lindemann–Weierstrass theorem. So why is it impossible? The culprit is " PI,π ". The Lindemann–Weierstrass theorem proved that pi (π) is transcendental (it is irrational but not the root of any polynomial with rational co-efficient). So it is impossible to find all digits of π. But π is such a special number that Mathematicians could just sit and not think about it. The next problem was to find π up-to greatest precision. Various algorithms/methods have been developed. I will discuss a few of them here.(I am discussing them based mostly on their simplicity and partly precision, also I discuss a few which interested me the most. You can try all of them by yourself)



1) The first method is the definition itself. So what is the definition of 'π'? Come on, go back to your high school days. Yes, the oldest and most prevalent one is it is the 'ratio of  the circumference of circle to its diameter'. So, your task is simple - Just take a compass and draw a circle with unit radius. Take a rope and place it on the circumference and measure its length. Now 'π' is just half of the obtained length. Job done! You have calculated value of 'π'. But the as stated above, Mathematicians require precision. Assuming you drawn a perfect circle and you use regular ruler to measure length of 'perfectly thin' rope you will get it right up-to around first decimal place. That's OK, for first try. But wait we can do better. Now draw a circle with radius 10 times the previous radius and "cha-ching"!!!..you have precision up-to second decimal place. Now go on increasing radius and in theory you can go to infinite precision. But  we all know that's just a ridiculously hard method to find 'π'. Let;s see if we can do better in further methods.

Bonus - You can do this even with a spherical ball. Just fill that ball with water. Next, weigh the ball+water and subtract the mass of the ball from it. We know the 1kg of water = 1L of water. Hence we know the volume of water a.k.a volume of sphere. 3/4th of this volume will give you 'π'. Easy? Damn yes....Practical for Mathematicians? Not so much.... 

2) So we have 1(and half) method behind us. What next? We can still do a bit with geometry. Not surprisingly, all the initial calculation of value of 'pi' is through geometry. Consider the following figure- Here we draw two squares(regular polygon of side 4), outside and inside the circle and compare the areas.
In 1st figure

...
...
...
In 2nd figure


...
...
...

Thus we get
 ...

Now, we inscribe circle into more complex regular polygons and repeat the process in a similar way i.e compare the areas and give upper and lower limits(Areas of polygon can be found very easily). 






Theoretically, a polygon of infinite sides should give us a perfect result. But practically this  is not possible. However we can go very far with method. In fact Archimedes had used this method to find 'π' and he had reached up-to a regular polygon of '96' sides simply called '96'-gon. With this he had estimated 'π' to close to 3+1/7This is close to 3.1428!!. This is very closto current estimates of  
3.1415. Even with no proper algebra, number system Archimedes had estimated 'π' to such high
accuracy.
EUREKA!!!
Francois Viete took this method further and used 393,216 sided polygon and calculated 'pi' up to 9 decimal place. Now that's what we should be aiming for - 393,216 sided polygon.
VOILA!!!
This method was further improved and values up-to 700-800 decimal places was found.

3) Next for a simple method let's check out our beloved Trigonometry and calculus for help. We know that tan(π/4) = 1. Thus its inverse, arctan(1) = π/4. Now we should get our hands dirty(don't blame me). We can expand any function at some point in terms any variable of our choice. If we expand in terms of sine and cosine functions it is called Fourier series. If we do it with polynomials we can call it Taylor series expansion. Now we can expand arctan function using Taylor which leads to messy formula(please do look up if want). The point is we can do it for any function and here we do it for arctan. Next I know arctan(1) = π/4 =1 - 1/3 + 1/5 - .... (got by using the expansion). Thus we can predict 'π' accurately.  But this converges very slowly - on running a python code with 5000000 iterations we get 5 decimal places accuracy. But we can use other trigonometric functions for the purpose, modify them and get better results.
Not only trigonometry but we can use various other methods. Ramanujan is well known for his very fast converging formulas for 'π'. His formulas give accuracy up-to several decimal places in just a single iteration. Here are some of them(as expected they look otherworldly)-



Bonus 1 - Here is the Python program for Trigonometric formula

>>> sum = 0
>>> for i in range(1,10000000,2):
k = int((i - 1)/2)
sum += ((-1)**k) * (1.0/i)

>>> pi = 4 *sum

Bonus 2 - Among the formulas, the Riemann zeta value of 'π' is interesting because it comes along with Riemann-Zeta function and Riemann's conjecture is closely attached to it. It's still an unsolved problem and one who solves it will get Millenium prize with prize money of US $1 million. It is one among the 7 Millennium Prize problems.


4) Above 3 are some of the conventional methods to find 'π' and they are very good at that. But there is one which sounds funny but works and has a solid mathematical basis. So here I go- just do whatever I tell and you shall manually find value of 'π'. 
Go out and draw a square of side '2' units and then draw a circle inside it as shown in figure1 above. This will have unit radius. Now a bit far from the setup and start throwing stones on the setup so that they fall at some place inside the square, wherever it may be. To get better results, blindfold yourself and start throwing stones in the direction of the setup. Continue this process until you are exhausted or stones around you are exhausted(or until you hit someone with a stone). Now remove the blindfold and start counting how many stones are inside the square and also how many of those are inside circle. Now divide no.of stones inside circle by no.of stones inside square as a whole. Multiply the obtained number by 4 and VOILA!!! You have calculated π. You will have a pretty good approximation of 'π' if you follow the above method. This is called 'Monte-Carlo' method. It is based on probability. It works in following way. I am sure you have solved problems on probability in 12th(if not you will learn it now!). Given 10 balls of different colors of which 2 are blue, what is the probability of getting a blue ball if you draw a ball at random? The answer is 2/10. Now greatly increase no.of balls and make it almost infinity. And spread them over your square. And increase no.of blue balls and spread them over your circle. Now I ask above question again, what's your answer? Naturally, the probability should be Area of circle/Area of the square. We also know that probability is no.of success/ no.of trials. In our experiment success is hitting circle and trials is hitting square. Thus combining two concepts we get π to [4*no.of stones inside the circle(success)/ no.of.stones inside square(trials)]. There you have your 'pi'. This can be checked in python by coding the algorithm. So here is the algorithm-For square of size 40 centered at the origin. This program gives pi up-to 2 decimal places. But for longer runs, it should give better results.

>>>import random
>>>n_hits = 0
>>>n_trials = 10**6
>>>for n_trials in range(n_trials):
    x,y = random.uniform(-20,20),random.uniform(-20,20)
    if x**2 + y**2 < 400 : n_hits+=1
>>>pi = 4 * n_hits/n_trials

>>>print(pi)

These are some the simple methods that I have come across to calculate 'π'. Because of its amazing property to pop up in every field it has generated much attention. You can already see the variety of methods and fields we have come across in the process and this just a drop in the ocean. There much more interesting problems in the field and that is for another day (i.e once I understand them, and if you already know about please write a post about and drop a link!!!).

Source -
1) Lots of interesting discussion and stories are available in Journey through Genius, by  William Dunham. It also contains various other math topics. Do check it out. It's AWESOME.
2) https://en.wikipedia.org/wiki/Squaring_the_circle
3) https://en.wikipedia.org/wiki/Pi
4) Python codes are written by me

Comments

  1. It is a treat to read your article. So much of interesting things.

    ReplyDelete

Post a Comment

Popular posts from this blog

Foreword to Avyukta English

Avyuktha is a word of Sanskrit origin. It means crystal clear. Contextually it sounds two meanings.    1) To be transparent    2)To understand easily We through this blog aim at providing     1) An inch of knowledge about different fields     2) Synchronise modern thoughts with ancient Indian knowledge  

Ripples in the Cosmos : Einstein's Messengers

Relativity was called “Einstein's Symphony”. Such was its beauty and Mathematical consistencies. Einstein had proposed his Special Theory of Relativity in 1905 and further generalised it to the gravitational case in his General Theory of Relativity in 1915.  Among many predictions, the bending of light due to gravitational fields was the most accessible at the time. This was confirmed  on May 29, 1919 , at the end of First World War by Sir Arthur Edington when he observed total solar eclipse by travelling to South Africa. This was a major triumph and set the base for further exploration in General Relativity and gave it the credibility. It  predicted many phenomena like Black Holes, Gravitational Lensing etc. All of these were confirmed and one of the last unconfirmed major predictions was Gravitational Waves. An artist's impression of   Merging of Black Holes So what is a Gravitational Wave? In short, it is like any other ripple that you see in some like medium lik