## The Gregory-Leibniz Series

$\pi = 4{(1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + ...)}$

$\frac{1}{1-y} = 1 + y + y^2 + ...$

Apply the variable substitution $y = -x^2$ to get

$\frac{1}{1+x^2} = 1 - x^2 + x^4 - x^6 + ...$

Now since $\frac{d}{dx}\tan^{-1}x = \frac{1}{1+x^2}$, by integrating, we find that the Taylor expansion of $\tan^{-1} x$ is

$\tan^{-1}x = x - \frac{x^3}{3} + \frac{x^5}{5} - ...$

and the formula is obtained by substituting $x = 1$.

### Variations

The Gregory-Leibniz Series converges very slowly. One way to improve it is to use

$\tan^{-1}\frac{1}{\sqrt{3}} = \pi/6 = \frac{1}{\sqrt{3}}{(1 - \frac{1}{3\cdot 3} + \frac {1}{5\cdot 3^2} - \frac {1}{7\cdot 3^3} + ...)}$

Even better is

$\tan^{-1}1 = \tan^{-1}\frac{1}{2} + \tan^{-1}\frac{1}{3} = \frac{1}{2}{(1 - \frac{1}{3\cdot 2^2} + \frac{1}{5\cdot 2^4} - ...)} + \frac{1}{3}{(1 - \frac{1}{3\cdot 3^2} + \frac{1}{5\cdot 3^4} - ...)}$

Another way that is handy for decimal digits is:

$\tan^{-1}(1) = 4 \tan^{-1}\frac{1}{5} - \tan^{-1}\frac{1}{239}$