<s>[INST] How to find continued fraction of pi I have always been amazed by the continued fractions for $\pi$. For example some continued fractions for pi are:
$\pi=[3:7,15,1,292,.....]$ and many others given here.
Similarly some nice continued fractions for $e$ and it's derivatives are given here.I have tried to prove that the are indeed the continued fractions but did not get very far.If any one can can help it would be great(especially if there is some easy way to get continued fraction of derivatives of e from the original continued fraction of e).Here derivatives of e I mean $\sqrt e,\frac{e-1}{e+1} $ etc.
 [/INST] A neat method to construct a continued fraction for $\pi$ is to use the addition formula for $\arctan$:
$$\arctan(x) + \arctan(y) = \arctan\left(\frac{x+y}{1-xy}\right)$$
which can also be written
$$\arctan\left(\frac{1}{x}\right) + \arctan\left(\frac{1}{y}\right) = -\arctan\left(\frac{x+y}{1-xy}\right) = \arctan\left(\frac{1}{x - \frac{1+x^2}{x+y}}\right)$$
Applying this formula one more time gives
$$\arctan\left(\frac{1}{x}\right) + \arctan\left(\frac{1}{y}\right) + \arctan\left(\frac{1}{z}\right) = \arctan\frac{1}{z-\frac{1+z^2}{z + x - \frac{1+x^2}{x+y}}}$$
and by induction we arrive at
$$\arctan\left(\frac{1}{x_1}\right)-\arctan\left(\frac{1}{x_2}\right)+\arctan\left(\frac{1}{x_3}\right) - \ldots = \arctan\cfrac{1}{x_1+\cfrac{1+x_1^2}{x_2-x_1 + \cfrac{1+x_2^2}{x_3 - x_2 + \ddots}}}$$
If we now let $x_k = \frac{2k-1}{\epsilon}$ form an arithmetic series then
$$\sum_{k=1}^\infty (-1)^{k-1}\arctan\left(\frac{\epsilon}{2k-1}\right) = \arctan\cfrac{\epsilon}{1+\cfrac{1+\epsilon^2}{2 + \cfrac{9+\epsilon^2}{2 + \cfrac{25+\epsilon^2}{2 + \ddots}}}}$$
Dividing by $\epsilon$ and taking $\epsilon\to 0$ gives us
$$1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \ldots = \cfrac{1}{1+\cfrac{1}{2 + \cfrac{9}{2 + \cfrac{25}{2 + \ddots}}}} = \frac{\pi}{4}$$
since the series on the left is just Leibniz formula for $\frac{\pi}{4}$. This can be used to generate other simple continued fractions with known sum by taking $x_k = \frac{ak+b}{\epsilon}$ (as long as we are able to evaluate $\sum(-1)^{k-1}\frac{1}{ak+b}$). The value of this particular continued fraction was first found by Brouncker and I came across it, and the method used to generate it, in an article by Viggo Brun in an old mathematics journal from the 1950's (it was not specified what method Brouncker used to derive it, other than that he derived it after learning about Wallis product formula).
</s>