# Pi approximation

The closest approximation of Pi for nearly a thousand years was calculated by Chinese mathematician Zu Chongzhi around 480 CE, using an algorithm developed by Liu Hui.

It’s time for pi! This elusive irrational number has been chased by many mathematicians throughout history, but few were as successful as Zu Chongzhi, an astronomer and mathematician of southern China. Zu Chongzhi, by the way, was one of many inventors to re-create the south-pointing chariot and he also invented the “thousand league boat,” the Chinese foot-powered paddle boat. But his greatest legacy was his calculations for pi.

A couple of hundred years before Zu, the mathematician Liu Hui had developed a clear algorithm that could approximate the value of pi highly accurately. Very roughly, it approximated the area of a circle and then worked backwards to reach pi. This is how it worked:

1. Draw a hexagon within a circle. You can easily calculate the area of this hexagon, but there are gaps between it and the edge of the circle. To find the area of the circle, you have to fill in those gaps.
2. Draw a line from the centre of the circle that goes through the edge of the hexagon and out to the circle’s edge. They look like spokes of the circle cutting halfway through each hexagon edge.
3. Draw lines from the points of the hexagon to the place where those spokes intersect the circle.
4. Those lines become the edges of a new shape with twice as many sides as the hexagon: a dodecagon. You’re effectively filling in those gaps between the original hexagon and the circle with a bunch of triangles.
5. You have all the measurements necessary to calculate the area of those triangles within the gaps, so you can work out the area of the dodecagon.
6. Repeat this process, doubling the number of sides again. And again. And again. Every time you do this, the area of the shape gets closer and closer to the area of the circle.

Zu took this algorithm and calculated the area out to a shape with 24,576 sides. From this he derived a shockingly accurate approximation of pi: 355/113.

This fraction – known today as Zu’s ratio, Zu’s fraction, or just Milü –  approximates pi to six decimal places. It was unprecedented, and indeed a more accurate representation of pi was not discovered anywhere for nearly a thousand years.