# How was this approximation of $\pi$ involving $\sqrt{5}$ arrived at?

The Wikipedia article for Approximations of $\pi$ contains this little gem:

$$\pi \approx \frac{63}{25}\times\frac{17 + 15\sqrt{5}}{7 + 15\sqrt{5}}$$

which is clearly in $\mathbb{Q[\sqrt{5}]}$. Wikipedia doesn't (currently) give a reference for this approximation. I also noticed that when re-written to move $\sqrt{5}$ out of the denominator, the resulting number in $\mathbb{Q[\sqrt{5}]}$ is

$$\pi \approx \frac{31689 + 4725\sqrt{5}}{13450}$$ and the integers involved are no larger than $5$ significant digits. How do you think this approximation was arrived at, and how might one go about finding a better approximation using more digits for the integers?

• Jan 5, 2015 at 20:08
• I don't know how it's arrived at, but the approximation is (also) due to Ramanujan. See the Wolfram MathWorld page for more information. It also contains references where you might find your answer. I should be able to check Berndt's "Ramanujan's Notebooks" to see if it can help. Jan 5, 2015 at 20:08
• @d125q, thanks for the reference. I'm still curious how something like this is derived (specifically using a quadratic extension). I found an article referenced in the Wolfram link you gave by Borwein and Bailey, but it didn't contain this particular approximation, and the other references are texts I'd rather not buy for one example. If you wouldn't mind checking "Ramanujan's Notebooks", I suspect it is in there. Jan 5, 2015 at 20:26
• Not the answer, but one can also grind away using a computer. For fun, I just found this one using $\sqrt{7}$: $$\frac{2762 + 3093\sqrt{7}}{3484} \approx 3.141592653594$$ The error is less than the error for the expression using $\sqrt{5}$ by two orders of magnitude. Jan 5, 2015 at 20:37
• What program are you using to do the grinding? Jan 5, 2015 at 20:38

Ramanujan discussed this and many similar approximations in his monumental paper Modular Equations and Approximations to $$\pi$$. Let me describe his idea in brief which is based on deep interconnection between the theory of elliptic integrals and theta functions.

Let $$0 < k < 1$$ and $$k' = \sqrt{1 - k^{2}}$$ then we define two elliptic integrals $$K(k) = \int_{0}^{\pi/2}\frac{dx}{\sqrt{1 - k^{2}\sin^{2}x}},\,E(k) = \int_{0}^{\pi/2}\sqrt{1 - k^{2}\sin^{2}x}\,dx\tag{1}$$ When the number $$k$$ (called modulus) is evident from context we use the symbols $$K, E, K', E'$$ for $$K(k), E(k), K(k'), E(k')$$. These numbers have a curious relation to $$\pi$$ which is not difficult to prove $$KE' + K'E - KK' = \frac{\pi}{2}\tag{2}$$ which goes by the name Legendre's Identity. This is the identity which forms the link between $$\pi$$ and elliptic integrals and it was exploited by Ramanujan to the fullest extent.

The formulas $$(1)$$ can be inverted in the sense that if we are given the values of $$K, K'$$ then we can obtain the corresponding value of $$k$$. But this happens in almost magical way via theta functions. Let us define a new variable $$q$$ called nome by $$q = e^{-\pi K'/K}$$ and we have the following theta functions (in simplified form) of Jacobi: \begin{align} \vartheta_{2}(q) &= \sum_{n = -\infty}^{\infty}q^{(n + 1/2)^{2}} = 2(q^{1/4} + q^{9/4} + q^{25/4} + \cdots )\notag\\ &= 2q^{1/4}\prod_{n = 1}^{\infty}(1 - q^{2n})(1 + q^{2n})^{2}\tag{3a}\\ \vartheta_{3}(q) &= \sum_{n = -\infty}^{\infty}q^{n^{2}} = 1 + 2q + 2q^{4} + 2q^{9} + \cdots\notag\\ &= \prod_{n = 1}^{\infty}(1 - q^{2n})(1 + q^{2n - 1})^{2}\tag{3b}\\ \vartheta_{4}(q) &= \sum_{n = -\infty}^{\infty}(-1)^{n}q^{n^{2}} = 1 - 2q + 2q^{4} - 2q^{9} + \cdots\notag\\ &= \prod_{n = 1}^{\infty}(1 - q^{2n})(1 - q^{2n - 1})^{2}\tag{3c} \end{align} and the values $$k, k', K$$ are obtained via formulas: $$k = \frac{\vartheta_{2}^{2}(q)}{\vartheta_{3}^{2}(q)},\, k' = \frac{\vartheta_{4}^{2}(q)}{\vartheta_{3}^{2}(q)},\, \frac{2K}{\pi} = \vartheta_{3}^{2}(q)\tag{4}$$

It is interesting to study the dependence of the nome $$q = e^{-\pi K'/K}$$ on modulus $$k$$. Equivalently one can also analyze the behavior of the ratio $$K'/K$$ as $$k$$ varies in the interval $$(0, 1)$$. It can be easily proved using the definitions $$(1)$$ that $$K'/K$$ is strictly decreasing as $$k$$ increases and $$K'/K \to \infty$$ as $$k \to 0^{+}$$ and $$K'/K \to 0$$ as $$k \to 1^{-}$$. Thus the ratio $$K'/K$$ as a function of $$k$$ establishes a bijection between interval $$(0, 1)$$ and the set of positive real numbers.

Next idea is to start with a specific value of $$k$$ and a positive number $$n$$ and then the number $$nK'/K$$ is also positive and hence (by the observation in previous paragraph) there is a unique number $$l \in (0, 1)$$ such that $$nK'/K = K'(l)/K(l)$$. It is customary to denote $$K(l), K'(l)$$ by $$L, L'$$ respectively and thus starting with a modulus $$k \in (0, 1)$$ and a positive real number $$n$$ we have found a unique $$l \in (0, 1)$$ such that $$\frac{L'}{L} = n\frac{K'}{K}$$ Jacobi extensively studied the integral transformations related to the elliptic integral $$K(k)$$ and proved that:

Jacobi's Theorem: If $$n$$ is a positive rational number and $$k\in (0, 1)$$ there there is a unique $$l \in (0, 1)$$ such that $$\frac{L'}{L} = n\frac{K'}{K}$$ and the relation between $$k, l$$ is algebraic. In other words in such a case there exists a polyomial $$P(x, y)$$ in two variables with integer coefficients such that $$P(k, l) = 0$$.

The algebraic relation between $$k, l$$ induced by the equation $$\frac{L'}{L} = n\frac{K'}{K}$$ is called a modular equation of degree $$n$$. And Jacobi gave such modular equations for $$n = 3, 5$$. Finding modular equations using integral transformations as described by Jacobi is really tough and impractical beyond $$n = 7$$.

Ramanujan was in love with these modular equations and he gave many modular equations for different positive integer values of $$n$$. But he had a much deeper insight into these topics and he asked:

What would happen if we add a further constraint $$l=k'=\sqrt{1-k^{2}}$$ in the modular equation connecting $$k, l$$?

With this additional constraint we now have an algebraic equation $$P(k, k') = 0$$ and thus both $$k, k'$$ are algebraic numbers. Also since $$l = k'$$ we have $$L = K', L' = K$$ so that $$L'/L = nK'/K$$ leads us to $$L'/L = \sqrt{n}, K'/K = 1/\sqrt{n}$$. The corresponding nomes for $$k, l$$ are now seen to be $$e^{-\pi/\sqrt{n}}$$ and $$e^{-\pi\sqrt{n}}$$. And thus we get the following deep theorem:

Theorem: If $$n$$ is a positive rational number and $$q = e^{-\pi\sqrt{n}}$$ then the numbers $$k, k'$$ given by equation $$(4)$$ in terms of $$q$$ are algebraic.

Ramanujan's great ability was manipulation of radicals and if there was an algebraic number of any mathematical significance then Ramanujan could express it in the form of an explicit radical. Ramanujan introduced the functions $$P, Q, R$$ given by \begin{align} P(q) &= 1 - 24\sum_{i = 1}^{\infty}\frac{iq^{i}}{1 - q^{i}}\tag{5a}\\ Q(q) &= 1 + 240\sum_{i = 1}^{\infty}\frac{i^{3}q^{i}}{1 - q^{i}}\tag{5b}\\ R(q) &= 1 - 504\sum_{i = 1}^{\infty}\frac{i^{5}q^{i}}{1 - q^{i}}\tag{5c} \end{align} and obtained the formulas \begin{align} P(q^{2}) &= \left(\frac{2K}{\pi}\right)^{2}\left(\frac{3E}{K} + k^{2} - 2\right)\tag{6a}\\ Q(q^{2}) &= \left(\frac{2K}{\pi}\right)^{4}\left(1 - k^{2} + k^{4}\right)\tag{6b}\\ R(q^{2}) &= \left(\frac{2K}{\pi}\right)^{6}(1 + k^{2})(1 - 2k^{2})\left(1 - \frac{k^{2}}{2}\right)\tag{6c} \end{align} Ramanujan was not happy with equation $$(6a)$$ and wanted it to contain only an expression in $$k$$ apart from the factor $$(2K/\pi)^{2}$$ and he found that for each positive rational number $$n$$ the expression $$nP(q^{2n}) - P(q^{2})$$ could be written as $$(2K/\pi)^{2}F_{n}(k)$$ where $$F_{n}(k)$$ is a complicated but algebraic function of $$k$$. Ramanujan obtained explicit radical expressions for $$F_{n} (k)$$ for some integer values of $$n$$. For small values of $$n$$ like $$2,3,5$$ it is not difficult to get these expressions, but no one knows how Ramanujan obtained the expressions for larger values of $$n$$. The method described by Ramanujan to evaluate these expressions is very tiresome and requires great skill in manipulation of radicals. Using this result he proved the following significant theorem:

Ramanujan's Theorem: If $$n$$ is a positive rational number and $$q = e^{-\pi\sqrt{n}}$$ then $$P(q^{2}) - \frac{3}{\pi\sqrt{n}} = \left(\frac{2K}{\pi}\right)^{2}A_{n}$$ where $$A_{n}$$ is an algebraic number dependent on $$n$$.

If $$n$$ is large then $$q = e^{-\pi\sqrt{n}}$$ is small and the functions $$P, Q, R$$ are close to $$1$$ and hence can be approximated by $$1$$. Also note that if $$n$$ is positive rational then $$k$$ is algebraic and in the light of above theorem and equations $$(6b), (6c)$$ we can see that $$\left(P(q^{2}) - \frac{3}{\pi\sqrt{n}}\right)Q(q^{2}) = B_{n}R(q^{2})\tag{7}$$ where $$B_{n}$$ is an algebraic number. Using approximation $$P, Q, R \approx 1$$ for large $$n$$ we get the approximation for $$\pi$$ $$\pi \approx \frac{3}{(1 - B_{n})\sqrt{n}}\tag{8}$$ The approximation in question is for $$n = 25$$. It is difficult to calculate the expression $$B_{n}$$ for generic $$n$$ but for $$n = 25$$ we can get the value the value of $$B_{n}$$ (with significant computational effort) so that the desired approximation for $$\pi$$ is obtained. Ramanujan also gives the estimate for error as $$24\pi(10\pi\sqrt{n} - 31)e^{-2\pi\sqrt{n}}$$.

Ramanujan also uses the identity $$C(q)=1-24\sum_{i=1}^{\infty}\frac{(2i-1)q^{2i-1}}{1-q^{2i-1}}=\left(\frac{2K}{\pi}\right)^{2}(1-2k^{2})\tag{9}$$ to get the equation $$P(q^{2})-\frac{3}{\pi\sqrt{n}}=C_{n}C(q)$$ where $$C_{n}$$ is algebraic and this leads to the approximation $$\pi\approx\frac{3}{(1-C_{n})\sqrt{n}}\tag{10}$$ and for $$n=25$$ this gives the much simpler but less accurate approximation $$\pi\approx \frac{9}{5}+\sqrt{\frac{9}{5}}\tag{11}$$ which is mentioned in another answer here.

Proof for Ramanujan's theorem can be found in my blog post. These techniques are further used by Ramanujan to give many famous series for $$1/\pi$$ (also covered in the blog post).

Update: Finally all the ingredients necessary to evaluate $$B_n$$ above for $$n=25$$ are available on math.se. I perform the desired evaluation below.

To set up things let us assume that $$l, \gamma, k$$ are elliptic moduli corresponding to the nomes $$e^{-5\pi},e^{-\pi},e^{-\pi/5}$$ and let $$q=e^{-\pi/5}$$. Let the corresponding elliptic integrals be denoted by $$L, \Gamma, K$$. It is well known that $$\gamma =\frac{1}{\sqrt {2}}, 2l^2=1-\sqrt{1-\phi^{-24}},2k^2=1+\sqrt{1-\phi^{-24}} \tag{12}$$ and we have $$k'=l, l'=k, \gamma'=\gamma$$ ($$\phi$$ is the golden ratio).

Also from this answer we have $$\frac{L} {\Gamma} =\frac{\sqrt{5}+2}{5}\tag{13}$$ Clearly from the transformation formula of theta functions it is obvious that $$K/L=5$$.

We now use the formula for $$F_n(k)$$ for $$n=5$$ given by Ramanujan and obtain $$5P(q^{10})-P(q^2)=\frac{4K\Gamma}{\pi^2}(3+k\gamma+k'\gamma')\sqrt{\frac{1+k\gamma+k'\gamma'}{2}}=25(\sqrt{5}-2)\left(\frac{2L}{\pi}\right)^2(3+(k+k')\gamma)\sqrt{\frac{1+(k+k')\gamma}{2}}\tag{14a}$$ and $$5P(q^{50})-P(q^{10})=\frac{4\Gamma L} {\pi^2}(3+l\gamma+l'\gamma')\sqrt{\frac{1+l\gamma+l'\gamma'}{2}}=5(\sqrt{5}-2)\left(\frac{2L}{\pi}\right)^2(3+(l+l')\gamma)\sqrt{\frac{1+(l+l')\gamma}{2}}\tag{14b}$$ Multiplying $$(14b)$$ by $$5$$ and adding the result to $$(14a)$$ we get $$25P(q^{50})-P(q^2)=50(\sqrt{5}-2)\left(\frac{2L}{\pi}\right)^2(3+(l+l')\gamma)\sqrt{\frac{1+(l+l')\gamma}{2}}$$ We have $$l+l'=\sqrt{l^2+l'^2+2ll'}=\sqrt{1+\phi^{-12}}$$ and thus $$(l+l') \gamma=\sqrt{\frac{1+\phi^{-12}}{2}}=3\phi^{-3}=3(2\phi-3)$$ and we finally arrive at $$25P(q^{50})-P(q^2)=50(\sqrt{5}-2)\left(\frac{2L}{\pi}\right) ^2(6\phi-6)\sqrt{3\phi-4}$$ On the other hand using logarithmic differentiation of transformation formula for Dedekind eta function allows us to prove that $$25P(q^{50})+P(q^2)=\frac{30}{\pi}$$ And adding last two equations we get $$P(q^{50})-\frac{3}{5\pi}=\left(\frac{2L}{\pi}\right) ^26(5-3\phi)\sqrt{3\phi-4}\tag{15}$$ And we have the standard relations $$Q(q^{50})=\left(\frac{2L}{\pi}\right)^4(1-l^2l'^2)=\left(\frac{2L}{\pi}\right)^4\left(\frac{4-\phi^{-24}}{4}\right)$$ and $$R(q^{50})=\left(\frac{2L}{\pi}\right)^6(1-2l^2)(1+(l^2l'^2/2))=\left(\frac{2L}{\pi}\right)^6\sqrt {1-\phi^{-24}}\left(\frac{8+\phi^{-24}}{8}\right)$$

The expression $$B_n$$ equals $$\frac{(P(q^{50})-(3/5\pi))Q(q^{50})} {R(q^{50})}$$ and using previous equations we get $$B_n=\frac{12(5-3\phi) \sqrt{3\phi-4}}{\sqrt{1-\phi^{-24}}}\cdot\frac{4-\phi^{-24}}{8+\phi^{-24}}$$ It turns out that the first fraction evaluates to $$\phi$$ (after some effort) and hence $$B_n=\frac{4\phi-\phi^{-23}}{8+\phi^{-24}}$$ and $$1-B_n=\frac{8-4\phi+\phi^{-23}+\phi^{-24}}{8+\phi^{-24}}=\frac{8-4\phi+\phi^{-22}}{8+\phi^{-24}}$$ The approximation for $$\pi$$ is now given by $$\pi\approx\frac{3}{5(1-B_n)}=\frac{3}{5}\cdot \frac{8+\phi^{-24}} {8-4\phi+\phi^{-22}}$$ Let $$a_m$$ denote Fibonacci sequence with $$a_0=0,a_1=1$$ and then $$a_{-m} =(-1)^{m+1}a_m$$ and we have $$\phi^m=a_m\phi+a_{m-1}$$ Using this relation we get $$\pi\approx\frac{3}{5}\cdot \frac{8+a_{25} -a_{24} \phi}{8+a_{23} -(4+a_{22})\phi}$$ Using a table of Fibonacci sequence we get $$a_{22} =17711,a_{23} =28657,a_{24}=46368,a_{25}=75025$$ and then $$\pi\approx\frac{3}{5}\cdot\frac{75033-46368\phi}{28665-17715\phi}=\frac{63}{25}\cdot\frac{3573-2208\phi}{5733-3543\phi}=\frac{63}{25}\cdot\frac{1646-736\sqrt{5}}{2641-1181\sqrt{5}}$$ and by this answer the second fraction equals $$\frac{17+15\sqrt{5}}{7+15\sqrt{5}}$$ Thus we obtain the famous approximation by Ramanujan $$\pi\approx \frac{63}{25}\cdot\frac{17+15\sqrt{5}}{7+15\sqrt{5}}$$ The approximation in equation $$(11)$$ can also be obtained in similar manner (with much less effort) by evaluating $$C_n$$ for $$n=25$$.

Ramanujan obtained most of his results (including the above) using algebraic manipulation combined with processes of calculus (differentiation and integration) and rarely used any sophisticated tools. Modern approach to Ramanujan's mathematics is so unlike his methods and is based on sophisticated techniques and theories (modular forms) which fail to generate any interesting results like those given by Ramanujan and are almost always dependent on software like Maple, Macsyma or Mathematica for any serious calculation.

• Equating the right hand side of approximations (10) and (11) with $n=25$ shows the value of the algebraic constant $C_n$ is half the golden ratio. $$C_{25}=\frac{1+\sqrt{5}}{4}=\frac{\phi}{2}$$ May 18, 2017 at 9:13
• @JaumeOliverLafont: Actually it is the value of $A_{n}$ for $n=25$ which is difficult to calculate. I have the formulas given by Ramanujan for calculating it, but the computation involves smart manipulation of radicals. Once we know $A_{n}$ the evaluation of $B_{n}, C_{n}$ is not that difficult. The calculation for $n=7$ is easy and equation $(8)$ gives the value $(19/16)\sqrt{7}$. May 18, 2017 at 9:50
• @JaumeOliverLafont: in case you are wondering about how $\phi$ comes into picture for $n=25$, then one has to note that the expression $(2kk')^{-1/12}=\phi$ if $n=25$. The expression $(2kk')^{-1/12}$ is one of Ramanujan's famous class invariants. See paramanands.blogspot.com/2012/03/… May 18, 2017 at 10:02
• And the parabola transformations? How do you explain them? May 18, 2017 at 10:07
• @JaumeOliverLafont: what are parabola transformation? I am not aware. Perhaps you can elaborate a bit. May 18, 2017 at 10:15

When I first came across your question, I thought it was a modern-day approximation by somebody using a computer. But when d125q pointed out it was by Ramanujan, then I figured out he must have used a systematic method.

One way is to use a Ramanujan-Sato pi formula like,

$$\frac{1}{\pi} = \frac{1}{16}\sum_{n=0}^\infty \frac{(2n)!^3}{n!^6}\frac{(42\phi-6)n+(5\phi-3)}{(2^{12}\phi^8)^n}\tag1$$

where $\phi=\frac{1+\sqrt{5}}{2}$, and truncate it as for finite number of terms. For example, using just $n=0\;\text{to}\;1$, and getting the reciprocal, it yields,

$$\pi \approx \frac{2^{13}}{3(-383+560\sqrt{5})}$$

It is only good for $10^{-7}$, and the next is $10^{-10}$, but there is an infinite choice of $n$.

There are three formulas in Mathworld that use a $\sqrt{5}$, including a version of $(1)$. And there is also a fourth. However, Ramanujan must have known still another formula because I can't get the approximation in your post by truncating any of the four.

• While this doesn't explain how to derive the original approximation, it does provide a method for getting other approximations with better accuracy using $\sqrt{5}$ which was the second part of my question. While I won't accept this as a full answer in its current form, it is still well done and well explained, so it gets my upvote. Jan 9, 2015 at 5:28
• @hatch22: Thank you. I was expecting to see the approximation using the four formulas, but sadly, it wasn't. How Ramanujan finds these things is part of the appeal. Jan 9, 2015 at 5:31
• If the approximation cannot be obtained truncating any one of the four formulas, can it be obtained combining more than one? Jan 30, 2016 at 23:50
• @JaumeOliverLafont: There are in fact dozens and dozens of Ramanujan-Sato pi formulas that use $\sqrt{5}$. It is possible, though not certain, that there is one responsible for this approximation. Jan 30, 2016 at 23:58
• This approximation is one of the many approximations which Ramanujan discussed at length in his paper Modular Equations and Approximations to $\pi$. I have given some details in my answer which you may find interesting. May 17, 2017 at 22:07

This is not yet a complete answer, but may be useful.

The largest root of the polynomial

$$269x^2-503x+209$$ is $$\frac{17+15\sqrt{5}}{7+15\sqrt{5}}$$

Changing the polynomial to $$(25)^2\times269x^2-25\times63\times 503 x+63^2\times 209$$

modifies the root to the approximation given. $$\pi\approx\frac{63}{25}\times\frac{17+15\sqrt{5}}{7+15\sqrt{5}}$$

In terms of the golden ratio, this is $$\pi\approx\frac{63}{25}\left(1+\dfrac{1}{3\phi-\dfrac{4}{5}}\right)$$

This seems related to the simpler polynomial $$25x^2-90x+36$$ that can have its coefficients factored as $$5^2x^2-5\times 6 \times 3x+6^2$$

and has the largest root $$\pi\approx \frac{9}{5}+\sqrt{\frac{9}{5}},$$

which is another approximation by Ramanujan that has a similar expression in terms of the golden ratio.

$$\pi\approx \dfrac{6}{5}\left(1+\dfrac{1}{\phi-1}\right)$$

This suggests an intermediate approximation of the form $$\pi \approx r_2\left(1+ \dfrac{1}{2\phi+d_2}\right)$$

and hopefully better precision with an expression similar to $$\pi \approx r_4\left(1+ \dfrac{1}{4\phi+d_4}\right)$$

or $$\pi \approx r_5\left(1+ \dfrac{1}{5\phi-d_5}\right)$$ if even multiples of $\phi$ are of no use. Fractions $r_n$ and $d_n$ are yet to be found.

• The approximation involving $9/5$ also comes from the same theory of Ramanujan which is used for the approximation in question. I have discussed that also in my answer. May 18, 2017 at 3:59

The very general rule with these close approximations is that they're arrived at by finding a continued fraction which has an unusually large term early on. You can then stop at that term and the error is small.

For example, taking the simple continued fraction for $\pi:$

$[3; 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, ...]$

If you stop at the $292$ you get an approximation good to $6$ decimal places.

Therefore to find the next very good approximation similar to your example given, find a continued fraction it's taken from, and stop at its next large term.

$\pi$ is related to the golden ratio $\Phi$ by:

$\pi=\frac{5}{\Phi}\cdot\frac{2}{\sqrt{2+\sqrt{2+\Phi}}}\cdot\frac{2}{\sqrt{\sqrt{2+\sqrt{2+\Phi}}}}\cdots$

Which is thanks to John Baez and Greg Egan

I suspect with a bit of jiggery pokery that might yield your example and its successors.