 Hong Kong
Stage 1 - Stage 3

# Generating data for probability analysis (Investigation)

Lesson Simple as pi...

Ever wondered where they get that number Pi from? When it is first introduced in class, textbooks usually explain that ancient civilisations discovered Pi by measuring the diameter of a circle, and measuring the circumference of a circle, and dividing one by the other. This is true, and the first estimations of Pi where made this way. During the creation of the Great Pyramid, the Ancient Egyptians calculated Pi to around 22/7, which is around 3.143. As you can see from the picture above, the first two decimal places are correct, but the third one isn't. We say that this estimate is "accurate to two decimal places". The image above shows Pi accurate to 1000 decimal places. Over thousands of years, we have gotten better and better at figuring out Pi to more and more decimal places. The table below shows a few of the highlights in the history of calculating Pi:

When Who Number of decimal places
2600 BCE Ancient Egyptians 2
150 CE Ptolemy 3
1400 Jamshid al-Kashi 16
1706  John Machin 100
1874 William Shanks 527
1949 John Wrench  2,037
1973 Jean Guilloud and Martin Bouyer 1,001,250
1989 Gregory and David Chudnovsky 1,011,196,691
2002 Yasumasa Kanada and team 1,241,100,000,000
2013 Shigeru Kondo 12,100,000,000,050

As you can imagine, it gets harder to get more accurate by measuring circles. It’s hard to draw a perfect circle in the first place, and measuring with pieces of string and rulers will always involve some inaccuracy. So how have we managed to figure out what Pi is to 12 trillion places? The answer is that there are other ways to calculate Pi. Starting with the Ancient Greeks, people realised that there are mathematical patterns that get closer and closer to Pi, and that you could use these to work out what Pi is without having to measure circles. You are going to try out one of these today, and find your very own value of Pi!

Grab a matchstick, toothpick, your pen, or any other straight object. Generally, smaller objects will be easier to work with than larger objects, so go for the smallest straight thing you can find. Next, grab a piece of paper and a ruler and make some parallel lines on it as in the diagram below, with the spacing between the lines being equal to the length of the straight object.

Next, put the paper on the floor and drop the object onto it, and see whether it hits on one of the lines or whether it misses them. Now do it again. And again. And again. Keep a tally of the number of "hits" and "misses". If it lands off the paper, do not count it all. In this diagram of dropping an object five times, three are "hits" and two are "misses"

We can use this data to figure out the probability (P) of the object landing on the lines. It is just:

P = \frac{\text{Hits }}{\text{Total Number of Drops}}

For example, in the diagram above we had three hits and five drops in total so the probability would be \frac{3}{5}

Once you have your probability (P), divide 2 by this number using a calculator. This is your estimate of Pi. In our example, we had P = \frac{3}{5}, so \frac{2}{P} would be 3.33, which is pretty close!

The accuracy of your estimation increases as you throw the object more times. If you had the patience to throw the object an infinite number of times, you could get Pi to as many places as you wanted. See how accurate you can get by throwing your object many times, and then try pooling the data from all of your classmates and see if that makes it more accurate.

Why does it work? Well, the answer is a bit complicated, and involves some university level mathematics. But if you feel like having a look, here it is

So far we have successfully found a way to find Pi without measuring circles with rulers, but this method obviously has problems of its own. Mathematicians do not sit in rooms throwing objects all day, so there must be an easier way of doing this.

If you have a look at the table of the history of calculation of Pi, you’ll notice that the number of decimal places gradually increased until 1949, when it was less than 1,000 places, and then suddenly shot up to more than 1,000,000,000,000 places in a little over fifty years. What changed? How were we able to suddenly achieve more in 50 years than our forebears had in 4000? The answer is right in front of you!

That’s right, it was the invention of electronic computers which changed everything. Suddenly you didn’t have to actually do something, you could just simulate doing it. It took William Shanks 15 years to approximate Pi to 527 places, as he had to do all the mathematical work by hand. By contrast, it took John Wrench only 70 hours to calculate Pi to 2,037 places, using the world's first electronic computer, the ENIAC

Want to try dropping your object 1000 times? Have a go at this website! See how much easier it is to let the computer do the work for you? This technique of using a large number of simulations to figure something out is known as a Monte Carlo method

Monte Carlo methods are not the only way to estimate Pi, there are many more (and more efficient) methods. The current world’s most efficient method involves calculating a rather scary looking formula: This answers the question as to how Shigeru Kondo, the current record holder, was able to calculate Pi to 12 trillion places. He owned a very fast computer, and left it running mathematical simulations for 94 days in order to get it to come up with such an accurate estimate. The software which he used to do this is free, so you can even download it here and try it for yourself at home or on your school computers! Most computers should have no problems calculating Pi to 100,000,000 places, which is better than the world record in 1986. If you leave it for long enough you might even be able to calculate 12 trillion decimal places or more yourself…the only problem is trying to find a hard drive big enough to store the answer in!