## Machin’s formula

There are many cool identities involving the number $\pi$. (Proof: trivially follows from looking at wikipedia page on $\pi$). Now, with more serious tone, I think the following is quite remarkable:

$\displaystyle\frac{\pi}{4}=4\arctan\frac{1}{5}-\arctan\frac{1}{239}$

This is known as Machin’s formula. Apparently, this identity (and its variations) provides a very fast algorithm to calculate many digits of $\pi$. There are probably multiple way of arriving at Machin’s formula (using tangent addition formula and such). There is a really nice approach outlined as exercise in Fundamentals of Complex Analysis by Saff and Snider, which will be the content of this blogpost.

Proof of Machin’s formula: Let’s take a look at the argument of the complex number $z=(1+i)(5-i)^4$ in two different ways. Since the argument of a product is the sum of the arguments, we get

$\displaystyle\arg z=\arg(1+i)+4\arg(5-i)=\frac{\pi}{4}+4\arctan\left(-\frac{1}{5}\right)=\frac{\pi}{4}-4\arctan\frac{1}{5}$

Now, we will calculate argument differently, namely, using brute force to expand the parenthesis. Okay here we go

$\displaystyle z=(1+i)(5-i)^4=(1+i)(5^4+4\cdot 5^3(-i)+6\cdot 5^2(-i)^2+4\cdot 5(-i)^3+(-i)^4)$

or equivalently,

$\displaystyle z=(1+i)(5-i)^4=(1+i)(625-500i-150+20i+1)=(1+i)(476-480i)$

which we can multiply out to get

$\displaystyle z=(1+i)(476-480i)=476-480i+476i-480i^2=956-4i$

But now, argument of $z$ can be readily computed:

$\displaystyle\arg z=\arctan\left(\frac{-4}{956}\right)=\arctan\left(-\frac{1}{239}\right)=-\arctan\frac{1}{239}$

Now combining with the other expression for argument of $z$, we deduce that

$\displaystyle\frac{\pi}{4}-4\arctan\frac{1}{5}=-\arctan\frac{1}{239}$

which can be rearranged to give Machin’s formula:

$\displaystyle\frac{\pi}{4}=4\arctan\frac{1}{5}-\arctan\frac{1}{239}$

Done!