Ramanujan mentioned the following continued fraction formula in his famous letter to G. H. Hardy in 1913:

$$\cfrac{4}{x +}\cfrac{1^{2}}{2x +}\cfrac{3^{2}}{2x +}\cdots = \left(\dfrac{\Gamma\left(\dfrac{x + 1}{4}\right)}{\Gamma\left(\dfrac{x + 3}{4}\right)}\right)^{2}\tag{1}$$ The form of the continued fraction is very familiar and I am aware of the standard result corresponding to $x = 1$ namely $$\pi = \cfrac{4}{1 +}\cfrac{1^{2}}{2 +}\cfrac{3^{2}}{2 +}\cdots\tag{2}$$ How do we generalize $(2)$ to get $(1)$?

Just for clarity the notation $$\cfrac{a_{1}}{b_{1}+}\cfrac{a_{2}}{b_{2}+}\cfrac{a_{3}}{b_{3}+}\cdots$$ consumes less space in typing compared to the more cumbersome but easier to understand continued fraction $$\cfrac{a_{1}}{b_{1} + \cfrac{a_{2}}{b_{2} + \cfrac{a_{3}}{b_{3} + \cdots}}}$$


2 Answers 2


A fairly straightforward approach, that generalizes to $${\raise{-1ex}\mathop{\huge\mathrm{K}}_{n=0}^\infty}\frac{a_2 n^2+a_1 n+a_0}{b_1 n+b_0}$$ (using Gauss' notation), is to consider exponential generating functions of the convergents.

The value of the above CF (if it exists) is $\lim\limits_{n\to\infty}(P_n/Q_n)$, where the vectors $R_n=(P_n,Q_n)$ satisfy $$R_0=(1,0),\quad R_1=(0,1),\quad R_{n+2}=(b_1 n+b_0)R_{n+1}+(a_2 n^2+a_1 n+a_0)R_n,\quad(n\geqslant 0)$$ and we find that the EGF $R(z)=\sum_{n=0}^\infty R_n z^n/n!$ satisfies $$(1-b_1 z-a_2 z^2)R''(z)-\big(b_0+(a_1+a_2)z\big)R'(z)-a_0 R(z)=0,$$ an ODE of hypergeometric $_2F_1$ type (after a linear change of variable).

In our case, $b_0=2x$, $b_1=0$, $a_0=1$, and $a_1=a_2=4$; we suppose $x>0$ is real (for simplicity). Then $$R(z)=C_1\times{}_2F_1\left(\frac12,\frac12;1+\frac{x}{2};\frac12-z\right)+C_2\times\ldots,$$ where "$\ldots$" stands for the second solution of the ODE, which is unbounded at $z\to 1/2$, and $C_1,C_2$ are some constants (which of course depend on $x$, and determined by $R(0)=R_0$ and $R'(0)=R_1$).

Writing $R(z)=\big(P(z),Q(z)\big)$ [recall that $R_n$ are vectors] and assuming that our CF converges (in fact it's not hard to prove) to $f(x)$, we know that $$f(x)=\lim_{z\to 1/2^-}\frac{P(z)}{Q(z)}.$$

This is equal to $A/B$, where $(A,B)=C_2$ is our second "constant". Computing it, we find $$f(x)=\frac{F'(1/2)}{F(1/2)},\qquad F(z)={}_2F_1\left(\frac12,\frac12;1+\frac{x}{2};z\right).$$

The value of $F(1/2)=\Gamma\big((x+1)/4\big)/\Gamma\big((x+3)/4\big)$ can be computed using the integral representation of $_2F_1$ (the substitution $t=x(2-x)$ helps; there is also a known formula). The value of $F'(1/2)$ is obtained similarly, after integration by parts.

Finally, we obtain the CF $(1)$ in the OP as $4/\big(x+f(x)\big)$. This gives the expected result.

An equivalent (and a bit easier) approach is to use the corresponding recurrence for $_2F_1$ instead of the ODE.

  • $\begingroup$ +1 for all the details. I may need to revisit a few resources on Gauss Hypergeometric functions in order to assimilate all of this. $\endgroup$
    – Paramanand Singh
    Jul 15, 2020 at 1:36

We'll go the other direction and generalize $(1)$ to get more pi formulas $(2)$. Ramanujan gave the more general,

$$F(a,b) = \frac{\Gamma\left(\frac{a+b+1}4\right)\Gamma\left(\frac{a-b+1}4\right)}{\Gamma\left(\frac{a+b+3}4\right)\Gamma\left(\frac{a-b+3}4\right)} = \cfrac{4}{a + \cfrac{1^2-b^2}{2a + \cfrac{3^2-b^2}{2a + \cfrac{5^2-b^2}{2a + \ddots}}}}$$

For $b=0$, this reduces to the one in Ramanujan's letter,

$$F(a,0) = \frac{\Gamma^2\left(\frac{a+1}4\right) }{\Gamma^2\left(\frac{a+3}4\right) } = \cfrac{4}{a + \cfrac{1^2}{2a + \cfrac{3^2}{2a + \cfrac{5^2}{2a + \ddots}}}}$$

Let $a$ be an odd integer, then $F(a,0)=F(a)$ is a rational multiple of $\pi$ or $1/\pi$. In closed-form,

\begin{align} F(4m+1) &= \pi\,\left(\frac{(2m)!}{2^{2m} m!^2}\right)^2\\ F(4m+3) &= \frac{4}{\pi}\left(\frac{2^{2m} m!^2}{(2m+1)!}\right)^2 \end{align}

The simplest is $m=0,$ yielding the familiar cfracs,

$$F(1) = \pi = \cfrac{4}{1 + \cfrac{1^2}{2 + \cfrac{3^2}{2 + \cfrac{5^2}{2 + \ddots}}}}, \qquad F(3) = \frac4{\pi} = \cfrac{4}{3 + \cfrac{1^2}{6 + \cfrac{3^2}{6 + \cfrac{5^2}{6 + \ddots}}}}$$

and so on.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .