# Ramanujan's approximation for $\pi$

In 1910, Srinivasa Ramanujan found several rapidly converging infinite series of $\pi$, such as $$\frac{1}{\pi} = \frac{2\sqrt{2}}{9801} \sum^\infty_{k=0} \frac{(4k)!(1103+26390k)}{(k!)^4 396^{4k}}.$$

Wikipedia says this formula computes a further eight decimal places of $\pi$ with each term in the series. There are also generalizations called Ramanujan–Sato series.

I tested it with Maple and really each term gives more eight right places. Anyone could tell me, how could each step give more eight correct digits?

• have you tried estimating the the ratio of successive terms? – David Holden Aug 25 '14 at 10:36
• That's awesome, but how do I calculate $\sqrt{2}$ that quickly? – John Joy Aug 25 '14 at 14:33
• @JohnJoy: calculation of square root involves precision arithmetic (+, -, *, /). We use the iteration $x_{n + 1} = (x_{n} + (a/x_{n}))/2$ starting with any random $x_{0} > 0$ and then $x_{n} \to \sqrt{a}$ very fast. – Paramanand Singh Sep 7 '14 at 8:18
• @ParamanandSingh: By the way, are you familiar how fundamental solutions to $p^2-29q^2=-1$ and $r^2-29s^2=1$ pop up in Ramanujan's formula above? Kindly see this post. – Tito Piezas III Dec 6 '14 at 22:10
• @TitoPiezasIII: I am really intrigued by your posts. You happen to identify any particular algebraic number in two contexts and connect them in surprising ways. You should probably put some more theory which explains such connections. – Paramanand Singh Dec 7 '14 at 11:44

It is easily seen that we can write the formula as $$\frac{1}{\pi} = \frac{2\sqrt{2}}{9801}\sum_{n = 0}^{\infty}\frac{(4n)!(1103 + 26390n)}{4^{4n}(n!)^{4}99^{4n}} = A\sum_{n = 0}^{\infty}B_{n}C_{n}$$ where $$A = \frac{2\sqrt{2}}{9801},\, B_{n} = \frac{(4n)!(1103 + 26390n)}{4^{4n}(n!)^{4}},\,C_{n} = \frac{1}{99^{4n}}$$ Now if we take a close look at $$A, B_{n}, C_{n}$$ then we note that $$A$$ is a constant and hence it does not have any impact on the rate of convergence of the series.

The term $$B_{n}$$ consists of a factorial part and a linear part. The factorial part $$(4n)!/4^{4n}(n!)^{4}$$ seems to remain almost constant when $$n$$ increases one by one. Clearly if we further write $$B_{n} = D_{n}E_{n}$$ where $$D_{n} = (4n)!/4^{4n}(n!)^{4}$$ and $$E_{n} = (1103 + 26390n)$$ then we can see that \begin{aligned}\frac{D_{n + 1}}{D_{n}} &= \frac{(4n + 4)!}{4^{4n + 4}((n + 1)!)^{4}}\cdot\frac{4^{4n}(n!)^{4}}{(4n)!}\\ &= \frac{(4n + 1)(4n + 2)(4n + 3)(4n + 4)}{4^{4}(n + 1)^{4}}\\ &= \frac{(4n + 1)(4n + 2)(4n + 3)}{(4n + 4)(4n + 4)(4n + 4)}\end{aligned} so that $$D_{n + 1}/D_{n}$$ is always less than $$1$$ and tends to $$1$$ as $$n \to \infty$$. The linear term $$E_{n}$$ on the other hand adds the value $$26390$$ extra in numerator in each successive term and the ratio $$E_{n + 1}/E_{n}$$ is always greater than $$1$$ but tends to $$1$$ as $$n \to \infty$$.

It follows that the factor $$B_{n} = D_{n}E_{n}$$ remains roughly constant as $$n$$ increases one by one. The real change happens because of the factor $$C_{n} = 1/99^{4n}$$ and we can see that $$99^{4n} \approx 100^{4n} = 10^{8n}$$ so that $$C_{n} \approx (1/10^{8})^{n}$$ This gives eight decimal zeroes as $$n$$ increases one by one. So we can see that it is the term $$C_{n}$$ which is the key behind getting eight decimal digits per term.

Update: On an unrelated note, this is one of the best results given by Ramanujan which is exceedingly difficult to prove and to date there is no proof available within the limits of hand calculation. Also important is to note that this is an early work of Ramanujan which was done in India before he got in touch with the British mathematician G. H. Hardy. In case you are interested in the theory behind this formula you can refer these posts here.

• I agree with @nbubis: Special thanks for providing a ref to your interesting blog post! :-) +1 of course – Markus Scheuer Sep 11 '14 at 8:25
• @MarkusScheuer: thanks! it seems my blog has finally paid off. – Paramanand Singh Sep 11 '14 at 9:27
• Oh, yes - and some of your contributions are of particular interest for me! :-) – Markus Scheuer Sep 11 '14 at 11:06
• Why the downvote?? – Paramanand Singh May 20 '16 at 20:35
• Hey! Please check your blog, is mathjax not applicable there? – Cooperation Jan 8 at 11:33

Using Stirling's formula, $$\frac{(4k)!}{(k!)^4}\sim\frac{4^{4k}}{\sqrt{2\pi^3k^3}}$$ Thus, as $k\to\infty$, the ratio of terms in the sum is \begin{align} \frac{a_{k+1}}{a_k} &\sim\frac{4^4}{396^4}\frac{k^{3/2}}{(k+1)^{3/2}}\frac{27493+26390k}{1103+26390k}\\ &\to\frac{4^4}{396^4}\\ &=\frac1{99^4}\\ &=\frac1{96059601}\\[6pt] &\approx10^{-8} \end{align} Thus, each term is approximately $10^{-8}$ of the term before it. Thus, the convergence of about $8$ digits per term.

• Would the downvoter care to comment? Is this answer really not useful? Using Stirling's formula provides a way to see that $\frac{(4k)!}{(k!)^4}$ removes $\sim2.4$ digits per term of the $\sim10.4$ digits per term that $396^{4k}$ provides. I can understand not upvoting if you think Stirling is too much. At least a comment explaining what I could improve would be useful. Paramanand's answer is detailed, and I've upvoted it, but as for how I would approach this question myself, it would be the way I've outlined above. – robjohn Sep 7 '14 at 9:07
• It wasn't me. But your solution gives about 8 digits per term, and the question was why is it exactly 8 digits per term. – user153012 Sep 7 '14 at 11:24
• @user153012: since $\log_{10}(96059601)=7.9825407783902$, this will be the average number of digits added per term of the sum. It will not be exactly $8$. After $100000$ terms, only $798254$ digits will be added. – robjohn Sep 7 '14 at 12:07
• @robjohn: since you are the moderator, I wish you could somehow disable "downvote without comment". Many users including me have suffered unnecessary downvotes. And +1 for concise answer. It took me so many words to convey the same idea. – Paramanand Singh Sep 7 '14 at 16:07
• @ParamanandSingh: sorry, moderators don't have the power to force people to comment when they downvote. However, downvoting is an indication that something is wrong with an answer, and if it is not clear what is wrong, a comment would sure be useful. – robjohn Sep 7 '14 at 23:32