## Archive for April, 2017

### Estimating the value of Pi with Archimedes

Sunday, April 23rd, 2017 Archimedes lived from 282 BC to 212 BC. He made many contributions to mathematics, engineering, physics, and astronomy.

He invented an interesting method of estimating Pi. He noticed that you can calculate a lower and upper bound for the ratio between the radius squared, and the area of a circle, which can estimate the value of Pi.

By drawing a square inside a circle and calculating its area, you can calculate a lower bound for what the area must be.

In this case, the square can be seen as four right angled triangles with length equal to the radius. Each triangle has an area of r * r / 2, which gives us a total area of 2r2.

Similarly, by drawing a square containing the circle, it has sides of length 2r, so has an area of 4r2. This gives us an upper bound for the area of the circle.

So, from these two calculations we know that the area lies between 2r2 and 4r2 – hence Pi lies between 2 and 4.

Doesn’t seem like a very accurate prediction. However, Archimedes realised that by using this same technique with polygons with more sides, he could get a more accurate estimate.

With a 10-sided polygon, the range becomes 0.31, a margin of error of 10%. With 100 sides, the estimate is accurate to two decimal places.

If you’re interested in the code that does the calculation, it’s available at GitHub.