Once in a Lifetime: Happy Pi Day!

Today is 3/14/15, which might be an appealing date if you like math and circles, because 3.1415 are the first few digits in the decimal expansion of pi. (Some people celebrate 3/14 as Pi Day every year, and for them, having the year be 2015 is just icing on the cake, or, um, the pie.) While I am not big on numerology, everybody’s talking about pi today, so here are a few choice tastes of it. Toward the end, there will be monkeys.

First off, let’s agree on what pi is. It’s not 3.1415, because that’s not exactly pi, and it’s not 3.1415…, because it’s not so clear what’s supposed to come after that “…” . Also, please don’t say it’s “some important mathematical constant,” because heaven knows there are plenty of those. Pi is the circumference of a circle of diameter 1. Which is both a definition and a math problem: if a circle is a mile across, how far is it around?

Since today is 3/14/15 and we’re talking about pi, you already know that the answer is “about 3.1415 miles.” Let’s try to picture that. Have a look at the diagram below:

pi There’s a circle, a hexagon inside the circle, and a square outside the circle, and they are all the same distance across — a mile, say. Let’s figure out how far each one is around.

  • The square is easy: since it’s a mile across in the center, each side is a mile too, so it’s 4 miles around.
  • The hexagon is a little harder. The dashed lines divide the hexagon up into six equilateral triangles. Each triangle has two inner sides, which are 1/2 mile long each, and an outer side, which must be 1/2 mile long too. The outside of the hexagon is made up of 6 of those outer sides, so it’s 3 miles across.

The circle fits between them, longer around than the hexagon, not as long around as the square. So pi, the distance around the circle, is between 3 and 4. The circle is a lot closer to the hexagon than it is to the square, so pi must be a lot closer to 3 than it is to 4. The picture may not make the number 3.1415 pop into your head, but it certainly makes that number look plausible.

Here’s another picture you might like:

circle_wedges

This one is an illustration of perhaps the most famous fact about pi. The idea is to rearrange the circle into something that looks like a rectangle. (The more wedges you cut the circle into, the more rectangular the rearrangement; you get a true rectangle “in the limit.”) The height of the rectangle is r, the length of the circle. The length of the base is half the circumference of the circle (blue wedges only). We can express the length of the circumference in terms of pi: if a circle that’s a mile across is pi miles around, then our circle here, which is 2r miles across, must be 2πr miles around. So the base of the rectangle is πr miles long. And if you know the base and the height of a rectangle, you can compute the area: πr times r, or πr². Which must be the area of the circle as well.

Oh yeah, I promised you monkeys. A hundred monkeys typing for a hundred years might not produce the works of William Shakespeare, but they can get you a pretty good estimate of pi. Here’s how:

  1. Generate a bunch of pairs (x, y) of random numbers between –1 and 1. If you are doing this by the monkey method, you need to take all the letters your monkeys have typed and figure out some way of turning them into numbers. For example, you can break up their typescript into four-letter segments, read each segment as a 4-digit decimal in base 26, and convert it to base 10. Then add a minus sign in front if the last base 26 digit was odd. These days, using a computer is probably faster, and less smelly.
  2. For each pair, decide if it lies inside the unit circle ( + < 1) or outside. Circle_area_Monte_Carlo_integration.svg
  3. Find the fraction of pairs that landed inside the unit circle (709/900 in the picture above) and multiply it by 4. The idea is that the circle has area pi (r = 1), and the square has area 4 (because each side has length 2), so each pair you generated had a π/4 chance of landing inside the circle. That means that pi should be about 4 times the probability that you actually observed. In the example above, 709/900 × 4 is about 3.151, which is pretty close, although it would mean that you’d have to wait for your pi till tomorrow.

So that’s pi for you, folks. A a smidgen more than 3, a lot less than 4, and monkeys people have been trying to say exactly how much it is for over 2000 years. Happy Pi Day!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s