## Sunday, March 14, 2010

### Happy PI day

Today, March 14, is pi day (3/14, 3.14 - get it?).  I'll try to post this at 1:59 (3.14159).

The origin of pi comes from the geometry of circles.  The diameter (D) of any circle, no matter what its size, multiplied by pi (p), equals the circumference (C) of that circle.  In other words:

p = C/D

If you want to determine pi, all you need to do is measure the circumference of a circle and divide that by the diameter.  That generally doesn't give you a very accurate value, however.

Let's supposed you measure something circular in your house, a  bowl for example, with one of those flexible tapes people use to measure their waistline.  As carefully as I can, I measured one in my kitchen and it had a circumference as 1070 mm and a diameter of 341 mm.  Doing the division C/D gives me 3.137 which I'll round to 3.14.  Not bad.

A small bit of difference in the measurement, however, can give quite a variation in pi.  It's easy to be a millimeter off when measuring with a flexible tape measure which would give me pi values ranging from 3.13 to 3.15.

Archimedes figured out how to calculate pi without any direct measurements over 2,000 years ago.  It was an ingenious method.  Archimedes knew that it was easy to determine the perimeter of a polygon.  He then reasoned that if you took a unit circle (radius = 1 unit), you can inscribe a polygon within the circle and one just outside the circle.  The circumference of the circle will be between the perimeter of the two polygons.  If you increase the number of sides of the polygon larger and larger, you'll more closely approximate the circumference of the circle (which will be pi/2 if the radius = 1).

With a 96-sided polygon, Archimedes was able to show that pi was between 3.140845 and 3.1428858.  Not much better than my simple measurement but ingenious since it allows for improvement (remember that Archimedes didn't have a calculator - calculating the perimeter of a 96-gon is quite a lot of work by hand!).

Today, there are many formulas for computing pi that have nothing to do with circles (pi pops up in all kinds of surprising places).  One neat way is a formula discovered by Liebniz, a German mathematician of the 1600s.

(PI / 4) = 1/1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 ...

There are dozens of other formulas for calculating pi, some converge slowly (like the one above), others much more quickly.

Fabrice Bellard, a French computer scientist, calculated 2.7 trillion digits of pi just this last January on a home computer running Linux.   If you're interested, here's 100,000 digits of pi.  Pi is infinite and non-repeating.

The tradional way to celebrate pi day is by having some pie.  Enjoy.