You might be surprised to see this post on the 22nd of July rather than March 14, but I’m publishing this blog about \(\pi\) today because there really are rather good reasons to think that 22/7 is a much better approximation to \(\pi\) than 3.14 – reasons that go beyond just conventional date formatting.

When I need to use \(\pi\) in my daily life, it’s almost always because I am estimating the volume of a cake tin, in which case the approximation I reach for is 3. It’s really easy to calculate with, and is about 4.5% off the true value. As far as bang for buck goes, this is not bad.

At school, we’re usually shown two approximations to \(\pi\) – 22/7 and 3.14. These are incorrect by 0.04% and 0.05% or so respectively. So from this perspective, they’re both pretty good approximations, although 22/7 is a bit closer.

However, an interesting question to ask is how efficient the approximation is.

What do I mean by this? The decimal approximation 3.14 is obtained by just cutting off some digits of \(\pi\) in base 10:

\[ \begin{eqnarray} \pi &=& 3 + \frac{1}{10} + \frac{4}{10^2} + \frac{1}{10^3} + \frac{5}{10^4} + ... \end{eqnarray} \]

You could also write \(\pi\) out in base 7:

\[ \begin{eqnarray} \pi &=& 3 + \frac{0}{7} + \frac{6}{7^2} + \frac{6}{7^3} + \frac{3}{7^4} + ... \end{eqnarray} \]

That pair of 6’s is a bit like a 99 in decimal – it’s more informative to allow a negative adjustment near the end and see that

\[ \begin{eqnarray} \pi &=& 3 + \frac{1}{7} + \frac{0}{7^2} + \frac{0}{7^3} + \frac{-3}{7^4} + ... \end{eqnarray} \]

Look at that pair of 0’s. In decimal, 3.14 uses two decimal fractional places to get 2 decimal fractional places of accuracy. In base 7, 22/7 uses 1 base 7 fractional place to get 3 base 7 fractional places of accuracy. This is why 22/7 should be considered such a good approximation to \(\pi\) – it is miraculously closer than you have any right to expect.

Another way to phrase this way of thinking about how good a rational approximation \(p/q\) is to an irrational value \(a\) is to look at the absolute difference between \(p/q\) and \(a\) as a power of \(q\). In symbols, find \(k\) so that

\[ \left|\frac{p}{q} - a\right| < \frac{1}{q^k} \]

One way to think about this is that it is what matching to \(k\) places base \(q\) means. Another way to think about it is that for any \(q\) you can get within \(1/2q\) of \(a\) just by picking the \(p\) that makes \(p/q\) closest. It’s only for special \(q\) that you can do better.

How does 22/7 do ? Well, the absolute difference between 22/7 and \(\pi\) is about 7 to the power 3.4 – which accords with our 3 digits right above.

Why does 22/7 do so well ? This is harder to answer, but the way to find excellent rational approximations (in this sense) is the mathematical technique known as the theory of continued fractions, which you can read about in the Wikipedia article about Continued Fractions. I can give you a sense of the process using a calculator. This is cheating since it has a reasonable decimal approximation to \(\pi\) built in, but I think it helps understand the idea:

The trick is to successively approximate as well as you can using integers

\[ \begin{eqnarray} \pi &=& 3.14159265358979323844... \\ &=& 3 + 0.14159265358979323844... \\ \end{eqnarray} \]

So \(\pi\) is about 3 – my cake approximation. Since this is the best integer approximation, the bit left over is less that 1. So it’s reciprocal is bigger than 1, and we can do the trick again:

\[ \begin{eqnarray} \pi - 3 &=& 0.14159265358979323844... \\ \frac{1}{\pi - 3} &=& 7.06251330593104577092... \\ &=& 7 + 0.06251330593104577092... \\ \end{eqnarray} \]

Look at that! Here is the 7 – and if we say that fractional bit is close enough to zero to ignore, we get

\[ \begin{eqnarray} \frac{1}{\pi - 3} &\approx& 7 \\ \pi - 3 &\approx& \frac{1}{7} \\ \pi &\approx& 3 + \frac{1}{7} = \frac{22}{7} \\ \end{eqnarray} \]

and thus we get the classic rational approximation from school.

But we can push it further:

\[ \begin{eqnarray} \frac{1}{\pi - 3} - 7 &=& 0.06251330593104577092... \\ \frac{1}{\frac{1}{\pi - 3} - 7} &=& 15.99659440668571960053... \\ &=& 15 + 0..99659440668571960053... \\ \frac{1}{\frac{1}{\pi - 3} - 7} - 15 &=& 0.99659440668571960053... \\ \frac{1}{\frac{1}{\frac{1}{\pi - 3} - 7} - 15} &=& 1.00341723101337289383... \\ &=& 1 + 0.00341723101337289383... \\ \frac{1}{\frac{1}{\frac{1}{\pi - 3} - 7} - 15} - 1 &=& 0.00341723101337289383... \\ \frac{1}{\frac{1}{\frac{1}{\frac{1}{\pi - 3} - 7} - 15} - 1} &=& 292.63459101437060689761... \\ &=& 292 + 0.63459101437060689761... \\ \frac{1}{\frac{1}{\frac{1}{\frac{1}{\pi - 3} - 7} - 15} - 1} - 292 &=& 0.63459101437060689761... \\ \end{eqnarray} \]

We tend to write this the other way up, just by solving the above equation for \(\pi\):

\[ \pi = 3 + \frac{1}{7 + \frac{1}{15 + \frac{1}{1 + \frac{1}{292 + \frac{1}{...}}}}} \]

If you ignore the long tail, you can get more great approximations to \(\pi\). The next is

\[ \pi \approx 3 + \frac{1}{7 + \frac{1}{15}} = \frac{333}{106} \]

which is within \(1/106^2\) of \(\pi\). The one after that is

\[ \pi \approx = 3 + \frac{1}{7 + \frac{1}{15 + \frac{1}{1}}} = \frac{355}{113} \]

with is within \(1/113^{3.2}\) of \(\pi\) – this was known to Chinese mathematicians in the 5th century AD.

The next great rational approximation to \(\pi\) is much larger – that 292 really pushes the numbers up, but if you grind it out you should get 103993/33102.

If you’re interested - try using the technique above to find rational approximations to \(\sqrt{2}\) or \(\sqrt{3}\) – there are interesting patterns in the continued fractions for irrationals of the form \(\sqrt{r}\) for integer values of \(r\).

Happy \(\pi\) Day everybody!