Archimedes' Pi Algorithm JavaScript Simulation Applet HTML5
Pi (π) is a pretty well-known constant (it even has it's own day, March 14!) around the world, and being both an irrational (a rational number is defined as a number that can be expressed in the form a/b, where a and b are integers, so an irrational number cannot be expressed in the form a/b) and a transcendental number (a transcendental number is defined as a number that is not a root of any non-zero polynomial that has rational coefficients - that means that there is no polynomial with rational coefficients with π as its root(s).), it has always been a topic of great interest to mathematicians worldwide.
So, a bit of background here. What exactly is π? And how do mathematicians manage to compute this enormously long decimal?
The most common definition of π is the ratio of a circle's circumference to its diameter. But how would one even begin to go about measuring it?
Around 250 BC, the Greek mathematician Archimedes came up with an algorithm for calculating π. The idea was to inscribe a regular polygon in a unit circle (meaning a circle with radius 1 and circumference 2π), and circumscribe another regular polygon outside the unit circle, making sure both polygons touch the circle.
Like so |
Now that we have a polygon that has a slightly larger circumference than the unit circle (the outer one), and another that has a slightly smaller circumference than the unit circle (the inner one), we end up having upper and lower bounds for the value of 2π. As the number of polygons increase, the value of the lower and upper bounds get closer and more accurate, providing a nice approximation to the value of π.
This simulation (link here) allows you to change the number n with a slider, where the regular polygon used to approximate 2π has 2^n sides.
The graph on the left shows the graphical approximation, and the top right corner shows the lower bound, upper bound, and the actual value of 2π (correct to 9 digits).
The graph on the right shows how the polygon is constructed from n = 2 to n = 3 using Pythagoras' Theorem.
Incidentally, Archimedes managed to accurately approximate π to 3 digits (3.14) with a 96-sided polygon. Better approximations were calculated by other mathematicians afterwards, such as Chinese mathematician Liu Hui, around 265 AD, who optimised the construction of the polygons and managed to approximate the value of π to 4 digits (3.141) with a 3072-sided polygon, and Chinese mathematician Zu Chongzhi, who used Liu Hui's algorithm to accurately calculate the value of π correct to 7 digits (3.141592) around 200 years later.