Here is a famous problem posed by Ramanujan

Show that $$\left(1 + \frac{1}{1\cdot 3} + \frac{1}{1\cdot 3\cdot 5} + \cdots\right) + \left(\cfrac{1}{1+}\cfrac{1}{1+}\cfrac{2}{1+}\cfrac{3}{1+}\cfrac{4}{1+\cdots}\right) = \sqrt{\frac{\pi e}{2}}$$

The first series seems vaguely familiar if we consider the function $$f(x) = x + \frac{x^{3}}{1\cdot 3} + \frac{x^{5}}{1\cdot 3\cdot 5} + \cdots$$ and note that $$f'(x) = 1 + xf(x)$$ so that $y = f(x)$ satisfies the differential equation $$\frac{dy}{dx} - xy = 1, y(0) = 0$$ The integrating factor here comes to be $e^{-x^{2}/2}$ so that $$ye^{-x^{2}/2} = \int_{0}^{x}e^{-t^{2}/2}\,dt$$ and hence $$f(x) = e^{x^{2}/2}\int_{0}^{x}e^{-t^{2}/2}\,dt$$ Thus the sum of the first series is $$f(1) = \sqrt{e}\int_{0}^{1}e^{-t^{2}/2}\,dt$$ But I have no idea about the continued fraction and still more I am not able to figure out how it would simplify to $\sqrt{\pi e/2}$ at the end.

Please provide any hints or suggestions.

Update: We have $$\begin{aligned}f(1) &= \sqrt{e}\int_{0}^{1}e^{-t^{2}/2}\,dt = \sqrt{e}\int_{0}^{\infty}e^{-t^{2}/2}\,dt - \sqrt{e}\int_{1}^{\infty}e^{-t^{2}/2}\,dt\\ &= \sqrt{\frac{\pi e}{2}} - \sqrt{e}\int_{1}^{\infty}e^{-t^{2}/2}\,dt\end{aligned}$$ and hence we finally need to establish $$\sqrt{e}\int_{1}^{\infty}e^{-t^{2}/2}\,dt = \cfrac{1}{1+}\cfrac{1}{1+}\cfrac{2}{1+}\cfrac{3}{1+}\cfrac{4}{1+\cdots}$$ On further searching in Ramanujan's Collected Papers I found the following formula $$\int_{0}^{a}e^{-x^{2}}\,dx = \frac{\sqrt{\pi}}{2} - \cfrac{e^{-a^{2}}}{2a+}\cfrac{1}{a+}\cfrac{2}{2a+}\cfrac{3}{a+}\cfrac{4}{2a+\cdots}$$ and it seems helpful here. But unfortunately proving this formula seems to be another big challenge for me.

Paramanand Singh
  • 79,254
  • 12
  • 118
  • 274
  • 1
    Why the downvote? Please share your feedback when you downvote. – Paramanand Singh Jun 15 '14 at 02:28
  • 2
    I usually avoid leaving feedback when I downvote, because it is my experience that neither I nor the person I downvoted is likely to be happy with the outcome. – MJD Jun 15 '14 at 02:46
  • 1
    @MJD: I can understand, sometimes people take a downvote personally, but I want to get the feedback so that I can improve my question or address downvoter's concern somehow. – Paramanand Singh Jun 15 '14 at 02:51
  • 2
    There is a well-known personality on MSE who takes downvotes very, very, very personally and who recently had his account suspended for a period of time so that he could cool his temper down. It is precisely because of such people who have tantrum problems that many members of the MSE community are very cautious about leaving comments when downvoting. – Berrick Caleb Fillmore Jun 15 '14 at 06:28
  • Anyway, the OP shows clear evidence of research (given that you browsed through Ramanujan’s Collected Papers), so I do not see why there should have been a downvote. – Berrick Caleb Fillmore Jun 15 '14 at 06:32
  • @ParamanandSingh I haven't seen your notation for continued fractions before. Is it standard? – Daniel R Jun 19 '14 at 07:23
  • @DanielR: The notation is quite standard hence $\mathrm\LaTeX$ has a standard "\cfrac" command for it instead of usual "\frac" or "\dfrac". – Paramanand Singh Jun 19 '14 at 11:53
  • Ah, ok. FWIW, I now found the notation also on [Wikipedia](http://en.wikipedia.org/wiki/Generalized_continued_fraction#Notation). – Daniel R Jun 19 '14 at 13:13
  • Oops! The downvote was me - I must have misclicked when I first saw this question. It's fixed now. –  Jun 22 '14 at 01:40
  • [A related question.](http://math.stackexchange.com/questions/351333) – J. M. ain't a mathematician Dec 27 '16 at 18:23

2 Answers2


This is a sketch of the proof, the details can be found here. I will offer this sketch because that paper was not intended to prove this result in particular, and I think that a proof might have been written somewhere else.

Consider Mills ratio defined by: $$\varphi(x)=e^{x^2/2}\int_x^\infty e^{-t^2/2}dt.$$

Proposition 1. There is a unique sequence of pairs of polynomials $((P_n,Q_n))_n$ such that $$\varphi^{(n)}(x)=P_n(x)\varphi(x)-Q_n(x)$$ Moreover, these polynomials can be defined inductively by $$P_{n+1}(x)=xP_n(x)+P'_n,\quad Q_{n+1}=P_n(x)+Q'_n(x)$$ with obvious initial conditions.

The proof in straightforward by induction.

Proposition 2. The sequences $(P_n)_{n}$ and $(Q_n)_{n}$ satisfy the following properties.

  1. $(P_0,P_1)=(1,x)$, and for all $n\geq1$ we have $P_{n+1}=xP_n+nP_{n-1}$.
  2. $(Q_0,Q_1)=(0,1)$, and for all $n\geq1$ we have $Q_{n+1}=xQ_n+nQ_{n-1}$.
  3. For all $n\geq1$ we have $P^\prime_{n}=nP_{n-1}$.

Indeed this follows from Leibniz $n$th derivative formula applied to $\varphi'(x)=x\varphi(x)-1$, and the uniqueness statement in Proposition 1.

Proposition 3. For all $n\geq0$, we have $Q_{n+1}P_n-P_{n+1}Q_n=(-1)^nn!$.

This also an easy induction.

Proposition 4. For all $n\geq0$, $(-1)^n\varphi^{(n)}(x)>0$.

This is a crucial step. Note that $$\varphi(x)=\int_0^\infty e^{-tx}e^{-t^2/2}dt$$ therefore $$\varphi^{(n)}(x)=(-1)^n\int_0^\infty t^ne^{-tx}e^{-t^2/2}dt$$

Corollary 5. The sequences $(P_n)_{n }$ and $(Q_n)_{n }$ satisfy the following properties.

  1. For all $n\geq0$, and all $x>0$, we have $${Q_{2n}(x)\over P_{2n}(x)}<\varphi(x)<{Q_{2n+1}(x)\over P_{2n+1}(x)}.$$
  2. For all $n\geq0$, and all $x>0$, we have $$\left|\varphi(x)-{Q_n(x)\over P_n(x)}\right|<\frac{n!}{P_n(x)P_{n+1}(x)}.$$
  3. For all $x>0$, we have $$ \lim_{n\to\infty}{Q_n(x)\over P_n(x)}=\varphi(x).$$

This last result, and the recurrence relations from Proposition 2. proves that $(Q_n/P_n)$ are the convergents of the non regular continued fraction: $$ \frac{Q_{n+1}}{P_{n+1}}=\cfrac{1}{x+\cfrac{1}{x+\cfrac{2}{x+\cfrac{3}{x+\cfrac{4}{x+\cfrac{\ddots}{n/x}}}}}} $$

Finally the desired equality follows from the fact that $\varphi(1)+f(1)=\sqrt{\frac{e\pi}{2}}$, where $f$ is the function considered by the OP. This concludes the sketch of the proof.$\qquad\square$

Paramanand Singh
  • 79,254
  • 12
  • 118
  • 274
Omran Kouba
  • 28,017
  • 1
  • 50
  • 94

The formula given by Ramanujan relating $\pi$ and $e$ is proven in [1] chapter 12 Entry 43 pg.166: $$ \sqrt{\frac{\pi e^x}{2x}}=\frac{1}{x+}\frac{1}{1+}\frac{2}{x+}\frac{3}{1+}\frac{4}{x+}...+\left\{1+\frac{x}{1\cdot3}+\frac{x^2}{1\cdot3\cdot5}+\frac{x^3}{1\cdot3\cdot5\cdot7}+...\right\} $$ The 'hard' term in Ramanujan's formula is the continued fraction. Fortunately the continued fraction can be evaluated in terms of $\textrm{Erfc}(x)$ function. More precicely holds for $Re(b)>0$ ([2] in Appendix pg.578): $$ \lambda(a,b):=\frac{\int^{\infty}_{0}t^a\exp\left(-bt-t^2/2\right)dt}{\int^{\infty}_{0}t^{a-1}\exp\left(-bt-t^2/2\right)dt}=\frac{a}{b+}\frac{a+1}{b+}\frac{a+2}{b+}\frac{a+3}{b+}\dots $$ Set $$ K:=\frac{1}{x+}\frac{1}{1+}\frac{2}{x+}\frac{3}{1+}\frac{4}{x+}... $$ Then one can see easily $$ K=\frac{1}{x+}\frac{\sqrt{x}}{\sqrt{x}+}\frac{2}{\sqrt{x}+}\frac{3}{\sqrt{x}+}\ldots $$ Setting $a=1$ and $b=\sqrt{x}$ in $\lambda(a,b)$, we get $$ K=\frac{1}{x+\sqrt{x}S} $$ where $$ S=\lambda(1,\sqrt{x})=\frac{1}{\sqrt{x}+}\frac{2}{\sqrt{x}+}\frac{3}{\sqrt{x}+}\ldots =\frac{\int^{\infty}_{0}te^{-t\sqrt{x}-t^2/2}}{\int^{\infty}_{0}e^{-t\sqrt{x}-t^2/2}} =\frac{e^{-x/2}\sqrt{\frac{2}{\pi}}}{\textrm{Erfc}\left(\sqrt{\frac{x}{2}}\right)}-\sqrt{x} $$ Hence $$ K=\sqrt{\frac{\pi e^x}{2x}}\textrm{Erfc}\left(\sqrt{\frac{x}{2}}\right) $$ Also the value of the sum in Ramanujan's formula is $$ \sqrt{\frac{e^x\pi}{2}}\textrm{Erf}\left(\sqrt{\frac{x}{2}}\right) $$ From all the above the result follows.

[1]: B.C.Berndt, Ramanujan`s Notebooks Part II. Springer Verlag, New York, 1989.

[2]: L.Lorentzen and H.Waadeland, Continued Fractions with Applications. Elsevier Science Publishers B.V., North Holland, 1992.

About the question for second identity we have:

Let $n$ be non negative integer, then we set $$ G_n(x,y):=\int^{\infty}_{0}t^{x+n}\exp\left(-yt-t^2/2\right)dt $$ With integration by parts we have $$ G_n(a,b)=\int^{\infty}_{0}\frac{d}{dt}\left(\frac{t^{a+n+1}}{a+n+1}\right)\exp\left(-bt-t^2/2\right)dt= $$ $$ =0-\int^{\infty}_{0}\frac{t^{a+n+1}}{a+n+1}\exp\left(-bt-t^2/2\right)(-b-t)dt= $$ $$ =b\frac{G_{n+1}(a,b)}{a+n+1}+\frac{G_{n+2}(a,b)}{a+n+1} $$ Hence setting $t_n=\frac{G_{n+1}(a,b)}{G_{n}(a,b)}$, $n=0,1,2,\ldots$ we have $$ t_n=\frac{n+a+1}{b+t_{n+1}} $$ and consequently $$ t_0=\frac{G_1(a,b)}{G_0(a,b)}=\lambda(a+1,b)=\frac{a+1}{b+}\frac{a+2}{b+}\frac{a+3}{b+}\ldots $$

Nikos Bagis
  • 6,637
  • 20
  • 31