The first time I encountered Pi in school, I was told that it was 22/7. Later I was told that it was just an approximation since Pi can never be expressed accurately with an infinite precision. If Pi is 3.14159... then why do we choose 22/7 ? Why not 314/100 or 314159/100000 ?

To answer this question, we will need to take a short journey to antiquity and get acquainted with mechanical clocks. Believe it or not, clocks were the cutting edge of computing technology until a few centuries ago. Multiplication and division of of numbers could be carried out using compound gears.

For e.g. if Gear A had 10 teeth and Gear B had 5 teeth, it would mean that 1 rotation of Gear A would cause 10/5 i.e. 2 rotations of Gear B. Now if Gear C had 8 teeth and Gear D had 4 teeth, then 1 rotation of Gear A would lead to 10/5 * 8 / 4 i.e. 4 rotations of Gear D. What if you wanted a clock to compute the circumference of a circle? Since the circumference of a circle is pi * 2 * r, you could use a series of compound gears to find the answer. Rotate the first gear once and the number of rotations of the last gear will give you the circumference of the circle.

The problem lies in finding a gear ratio which can approximate Pi. While an infinite number of ratios could fit the bill, the clock makers were particularly interested in those that had small numerator and denominator values. Why? The smaller the numerator and denominator, the less teeth they needed to carve into their gears thereby allowing them to create more compact gears. This is where mediants come into the picture. Quite simply, given two ratios a/b and c/d, a mediant is nothing but the ratio (a+c)/(b+d) and it can be shown that the mediant always lies between a/b and c/d. We can thus come up with an algorithm to approximate Pi using mediants.

We will start with 3/1 and 4/1. The mediant is (3+4)/(1+1) i.e. 7/2. Since 7/2 is greater than Pi, we will update the interval to 3/1 and 7/2. If we continue the process, we will get the following approximations to Pi.

As you can see, 22/7 is the closest approximation among the first 13 mediants. And to top it, it uses much fewer teeth than 179/57, the next best approximation. This explains why 22/7 gets the honor to act as Pi's proxy in high schools. So the next time you see 22/7 bandied about as an approximation to Pi, treat it with a little more respect.

## Comments