# Ramanujan's eccentric Integral formula

The wikipedia page on Srinivasa Ramanujan gives a very strange formula:

Ramanujan: If $0 < a < b + \frac{1}{2}$ then, $$\int\limits_{0}^{\infty} \frac{ 1 + x^{2}/(b+1)^{2}}{ 1 + x^{2}/a^{2}} \times \frac{ 1 + x^{2}/(b+2)^{2}}{ 1 + x^{2}/(a+1)^{2}} \times \cdots \ \textrm{dx} = \frac{\sqrt{\pi}}{2} \small{\frac{ \Gamma(a+\frac{1}{2}) \cdot \Gamma(b+1)\: \Gamma(b-a+\frac{1}{2})}{\Gamma(a) \cdot \Gamma(b+\frac{1}{2}) \cdot \Gamma(b-a+1)}}$$

• Question I would like to pose to this community is: What could be the Intuition behind discovering this formula.

• Next, I see that Ramanujan has discovered a lot of formulas for expressing $\pi$ as series. May I know what is the advantage of having a same number expressed as a series in a different way. Is it useful at all?

• From what I know Ramanujan basically worked on Infinite series, Continued fractions, $\cdots$ etc. I have never seen applications of continued fractions, in the real world. I would also like to know if continued fractions has any applications.

Hope I haven't asked too many questions. As I was posting this question the last question on application of continued fractions popped up and I thought it would be a good idea to pose it here, instead of posing it as a new question.

• I really think you're asking three separate questions here. A split might not be such a bad idea. – Andrey Rekalo Jun 3 '11 at 10:42
• I think you should read up on Ramanujan some more. There is really not much percentage in taking a formula like this in isolation and brainstorming some queries about it. – Charles Matthews Jun 3 '11 at 11:50
• The formula you cite is incorrect; please double check--(b+1 in second term, instead of b+2) – Suvrit Jun 3 '11 at 12:14
• You've asked about the intuition behind Ramanujan's formulas before. I doubt you'll get a better answer this time, but maybe someone will prove me wrong. – Gerry Myerson Jun 3 '11 at 12:23
• Believe it or not, the integrand is a quotient of products of $\Gamma$-functions, integrated over a vertical line in the complex plane, and the integral pops out after a clever use of the Plancherel theorem for Mellin transforms. – David Hansen Jun 3 '11 at 14:26

This is one of those precious cases when Ramanujan himself provided (a sketch of) a proof. The identity was published in his paper "Some definite integrals" (Mess. Math. 44 (1915), pp. 10-18) together with several related formulae.

It might be instructive to look first at the simpler identity (i.e. the limiting case when $b\to\infty$; the identity mentioned in the original question can be obtained by a similar approach): $$\int\limits_{0}^{\infty} \prod_{k=0}^{\infty}\frac{1}{ 1 + x^{2}/(a+k)^{2}}dx = \frac{\sqrt{\pi}}{2} \frac{ \Gamma(a+\frac{1}{2})}{\Gamma(a)},\quad a>0.\qquad\qquad\qquad(1)$$ Ramanujan derives (1) by using a partial fraction decomposition of the product $\prod_{k=0}^{n}\frac{1}{ 1 + x^{2}/(a+k)^{2}}$, integrating term-wise, and passing to the limit $n\to\infty$. He also indicates that alternatively (1) is implied by the factorization $$\prod_{k=0}^{\infty}\left[1+\frac{x^2}{(a+k)^2}\right] = \frac{ [\Gamma(a)]^2}{\Gamma(a+ix)\Gamma(a-ix)},$$ which follows readily from Euler's product formula for the gamma function. Thus (1) is equivalent to the formula $$\int\limits_{0}^{\infty}\Gamma(a+ix)\Gamma(a-ix)dx=\frac{\sqrt{\pi}}{2} \Gamma(a)\Gamma\left(a+\frac{1}{2}\right).$$

There is a nice paper "Wallis-Ramanujan-Schur-Feynman" by Amdeberhan et al (American Mathematical Monthly 117 (2010), pp. 618-632) that discusses interesting combinatorial aspects of formula (1) and its generalizations.

Regarding your three questions:

I have no idea what the intuition is behind Ramanujan's formula, but I hope someone else does, since I'd certainly like to know.

Expressing the same number as a series in different ways is generally not useful per se, assuming you don't count being interesting or beautiful as being useful. Replacing a slowly converging series with a rapidly converging one can be useful if you want to compute a numerical approximation. If you get lucky, a new series may lead to a remarkable algorithm (such as the Bailey-Borwein-Plouffe algorithm for computing individual binary digits of $\pi$) or irrationality proof (such as Apery's proof of the irrationality of $\zeta(3)$), but you certainly can't count on that.

As for applications of continued fractions in the real world, I don't know of many applications for continued fraction expansions of real numbers. Of course simple continued fractions are critical if you want good rational approximations, but not very many people do want them in practice.

On the other hand, continued fraction expansions of functions have lots of real-world uses. The intuition is that people are rarely interested in the properties of specific numbers in applied problems, but they are more likely to be interested in specific functions.

For example, the Berlekamp-Massey algorithm efficiently reconstructs a linear recurrence relation from a sequence satisfying it, and it can be reformulated in terms of computing the continued fraction expansion of a rational function. This is "linear feedback shift register synthesis", which comes up in many practical problems; among other things, it's used for decoding Reed-Solomon error-correcting codes, which are used on CDs, DVDs, and Blu-ray discs. It also comes up in some Krylov subspace algorithms for sparse linear algebra, such as the Wiedemann algorithm.

Another practical application is computing in the Jacobian of a hyperelliptic curve $y^2 = f(x)$ over a field $K$ (which may not sound very practical, but it is if you want to do hyperelliptic curve cryptography). This amounts to finding a reduction algorithm for divisors on the curve, and it can be done very efficiently if you know how the continued fractions of functions in $K(x,\sqrt{f(x)})$ behave.

A third case is computing Pade approximants of transcendental functions (this goes slightly beyond continued fractions, but is closely connected). Pade approximants give excellent rational function approximations to a given function, which are much more tractable on a computer than the original function was.

Here is a proof of Ramanujan's identity (thanks to Todd Trimble for encouraging me to post this!). As Andrey Rekalo notes, we have the identity $$\displaystyle\prod\limits_{k=0}^{\infty}(1+\frac{x^2}{(k+a)^2})=\frac{\Gamma(a)^2}{|\Gamma(a+ix)|^2}$$

In particular, the integrand in Ramanujan's integral is $\dfrac{\Gamma(b+1)^2 |\Gamma(a+ix)|^2}{\Gamma(a)^2 |\Gamma(b+1+ix)|^2}$. Hence, after a little algebra (and also changing $b$ to $b-1$; I personally think Ramanujan made the wrong aesthetic choice here), we need to prove the integral evaluation $$I=\displaystyle\int\limits_{-\infty}^{\infty} \frac{|\Gamma(a+ix)|^2}{|\Gamma(b+ix)|^2}dx=\sqrt{\pi}\frac{\Gamma(a)\Gamma(a+1/2)\Gamma(b-a-1/2)}{\Gamma(b-1/2)\Gamma(b)\Gamma(b-a)}$$

Now, if $f(x)$ has Mellin transform $F(s)$, then one form of Parseval's theorem for Mellin transforms is the identity $$\int_{0}^{\infty}|f(x)|^{2}x^{-1}dx=\frac{1}{2\pi}\int\limits_{-\infty}^{\infty}|F(it)|^2 dt$$

(under suitable conditions of course). Applying this with the Mellin pair $f(x)=\Gamma(b-a)^{-1}x^{a}(1-x)^{b-a-1}$ if $0\leq x \leq 1$ (and $f=0$ otherwise), $F(s)=\dfrac{\Gamma(s+a)}{\Gamma(s+b)}$ gives

$$I=2\pi \Gamma(b-a)^{-2} \int\limits_{0}^{\infty}x^{2a-1}(1-x)^{2b-2a-2}dx$$

$$=2\pi \Gamma(b-a)^{-2} \frac{\Gamma(2a) \Gamma(2b-2a-1)}{\Gamma(2b-1)}$$

Next, apply the formula $\Gamma(2z)=2^{2z-1}\pi^{-1/2}\Gamma(z)\Gamma(z+1/2)$ to each of the $\Gamma$-functions in the quotient here, getting

$$I=\sqrt{\pi} \frac{\Gamma(a)\Gamma(a+1/2)\Gamma(b-a-1/2)\Gamma(b-a)}{\Gamma(b-a)^2 \Gamma(b-1/2) \Gamma(b)}$$And cancelling $\Gamma(b-a)$ concludes the proof.

Exercise: Give a proof, along similar lines, of the formula

$$\int_{-\infty}^{\infty} |\Gamma(a+ix)\Gamma(b+ix)|^2 dx=\sqrt{\pi}\cdot\frac{\Gamma(a)\Gamma(a+1/2)\Gamma(b)\Gamma(b+1/2)\Gamma(a+b)}{\Gamma(a+b+1/2)}$$

And determine for what range of $a,b$ it holds.

Another proof of the Ramanujan's identity is given in https://arxiv.org/abs/1309.3455 (On gamma quotients and infinite products, by Marc Chamberland, Armin Straub). It is based on the formula $$\prod_{k=0}^\infty \frac{(k+\alpha_1)\cdots (k+\alpha_n)}{(k+\beta_1)\cdots (k+\beta_n)}=\frac{\Gamma(\beta_1)\cdots\Gamma(\beta_n)}{\Gamma(\alpha_1)\cdots\Gamma(\alpha_n)}, \tag{1}$$ where $n\ge 1$ is an integer, $\alpha_1,\ldots,\alpha_n$ and $\beta_1,\ldots,\beta_n$ are nonzero complex numbers, none of which are negative integers, and $\alpha_1+\ldots +\alpha_n=\beta_1+\ldots +\beta_n$.

Using the factorization $$\frac{1+x^2/(b+k)^2}{1+x^2/(a+k)^2}=\frac{(k+a)^2(k+b+ix)(k+b-ix)}{(k+b)^2(k+a+ix)(k+a-ix)},$$ and (1), Ramanujan's product transforms to $$\prod_{k=0}^\infty\frac{1+x^2/(b+k)^2}{1+x^2/(a+k)^2}=\frac{\Gamma(b)^2\Gamma(a+ix)\Gamma(a-ix)}{\Gamma(a)^2\Gamma(b+ix)\Gamma(b-ix)},$$ and then the Ramanujan's identity is equivalent to the Mellin–Barnes integral (in this respect, see also David Hansen's answer below) $$\frac{1}{2\pi i}\int_\limits{-i\infty}^{i\infty}\frac{\Gamma(a+s)\Gamma(a-s)}{\Gamma(b+s)\Gamma(b-s)}ds=\frac{1}{2\sqrt{\pi}}\frac{\Gamma(a)}{\Gamma(b)}\frac{\Gamma\left(a+1/2\right)\Gamma\left(b-a-1/2\right)}{\Gamma\left(b-1/2\right)\Gamma(b-a)}.$$