# Large $n$ asymptotic of $\int_0^\infty \left( 1 + x/n\right)^{n-1} \exp(-x) \, \mathrm{d} x$

While thinking of 71432, I encountered the following integral: $$\mathcal{I}_n = \int_0^\infty \left( 1 + \frac{x}{n}\right)^{n-1} \mathrm{e}^{-x} \, \mathrm{d} x$$ Eric's answer to the linked question implies that $\mathcal{I}_n \sim \sqrt{\frac{\pi n}{2}} + O(1)$.

How would one arrive at this asymptotic from the integral representation, without reducing the problem back to the sum ([added] i.e. expanding $(1+x/n)^{n-1}$ into series and integrating term-wise, reducing the problem back to the sum solve by Eric) ?

-
what if expand brackets and write series in Gamma-functions? –  Ilya Oct 10 '11 at 15:10
@Gortaur In that case we would arrive back to the sum Eric dealt with. I am hoping for something like a saddle point approximation approach. –  Sasha Oct 10 '11 at 15:13
I see, sorry - didn't understand which sum you tried to avoid –  Ilya Oct 10 '11 at 15:14
Not sure, if it counts, but your integral evaluates as $n\exp(n) E_{1-n}(n)$, where $E_p(z)$ is the generalized exponential integral. If you use this expansion along with Stirling, you obtain $\sqrt{2\pi n}$ as the first term... –  Ｊ. Ｍ. Oct 10 '11 at 15:46
For what it's worth, this integral and its relationship to the sum in Question 71432 is mentioned in Flajolet, Grabner, Kirschenhofer, and Prodinger, "On Ramanujan's Q-Function" (Journal of Computational and Applied Mathematics 58 (1995), 103-116). –  Mike Spivey Oct 10 '11 at 16:10

With the change of variables $x\to(n-1)t-1$, we get \begin{align} &\int_0^\infty\left(1+\frac{x}{n}\right)^{n-1}e^{-x}\;\mathrm{d}x\\ &=ne\left(1-\frac{1}{n}\right)^n\int_\frac{1}{n-1}^\infty e^{-(n-1)(t-\log(1+t))}\;\mathrm{d}t\tag{1}\\ \end{align} Since $$1+n\log\left(1-\frac{1}{n}\right)=-\frac{1}{2n}-\frac{1}{3n^2}+O\left(\frac{1}{n^3}\right)$$ exponentiating and multiplying by $n$, we get \begin{align} ne\left(1-\frac{1}{n}\right)^n &=ne^{-\frac{1}{2n}-\frac{1}{3n^2}+O\left(\frac{1}{n^3}\right)}\\ &=n-\frac{1}{2}-\frac{5}{24n}+O\left(\frac{1}{n^2}\right)\tag{2} \end{align} Note that \begin{align} \int_0^\frac{1}{n-1} e^{-(n-1)(t-\log(1+t))}\;\mathrm{d}t &=\int_0^\frac{1}{n-1}\left(1-\tfrac{n-1}{2}t^2+\tfrac{n-1}{3}t^3+\tfrac{(n-1)^2}{8}t^4\right)\;\mathrm{d}t+O\left(\tfrac{1}{n^4}\right)\\ &=\frac{1}{n-1}-\frac{1}{6(n-1)^2}+\frac{13}{120(n-1)^3}+O\left(\frac{1}{n^4}\right)\\ &=\frac{1}{n}+\frac{5}{6n^2}+\frac{31}{40n^3}+O\left(\frac{1}{n^4}\right)\tag{3} \end{align} Finally, setting $\frac{u^2}{2}=t-\log(1+t)$, so that $t=u+\frac{u^2}{3}+\frac{u^3}{36}-\frac{u^4}{270}+\frac{u^5}{4320}+\frac{u^6}{17010}+O(u^7)$, we get \begin{align} &\int_0^\infty e^{-(n-1)(t-\log(1+t))}\;\mathrm{d}t\\ &=\int_0^\infty e^{-(n-1)u^2/2}\;\mathrm{d}t\\ &=\int_0^\infty e^{-(n-1)u^2/2}\;(1+\frac{2u}{3}+\frac{u^2}{12}-\frac{2u^3}{135}+\frac{u^4}{864}+\frac{u^5}{2835}+O(u^6))\;\mathrm{d}u\\ &=\sqrt{\tfrac{\pi}{2(n-1)}}+\tfrac{2}{3(n-1)}+\sqrt{\tfrac{\pi}{288(n-1)^3}}-\tfrac{4}{135(n-1)^2}+\sqrt{\tfrac{\pi}{165888(n-1)^5}}+\tfrac{8}{2835(n-1)^3}+O\left(\tfrac{1}{n^{7/2}}\right)\\ &=\sqrt{\tfrac{\pi}{2n}}\left(1+\tfrac{7}{12n}+\tfrac{145}{288n^2}\right)+\left(\tfrac{2}{3n}+\tfrac{86}{135n^2}+\tfrac{346}{567n^3}\right)+O\left(\tfrac{1}{n^{7/2}}\right)\tag{4} \end{align} Combining $(3)$ and $(4)$, we get $$\int_\frac{1}{n-1}^\infty e^{-(n-1)(t-\log(1+t))}\;\mathrm{d}t=\sqrt{\tfrac{\pi}{2n}}\left(1+\tfrac{7}{12n}+\tfrac{145}{288n^2}\right)-\left(\tfrac{1}{3n}+\tfrac{53}{270n^2}+\tfrac{3737}{22680n^3}\right)+O\left(\tfrac{1}{n^{7/2}}\right)$$ Including $(2)$, yields $$\int_0^\infty\left(1+\frac{x}{n}\right)^{n-1}e^{-x}\;\mathrm{d}x=\sqrt{\tfrac{n\pi}{2}}\left(1+\tfrac{1}{12n}+\tfrac{1}{288n^2}\right)-\left(\tfrac{1}{3}+\tfrac{4}{135n}-\tfrac{8}{2835n^2}\right)+O\left(\tfrac{1}{n^{5/2}}\right)$$

-
Added a bit more of the asymptotic expansion –  robjohn Oct 10 '11 at 21:07
Your edited answer is close, but doesn't quite agree with the published result in Flajolet, et al, mentioned in my comment on the original question. (The integral is equal to $Q(n)$ in their paper; see Theorem 2.) –  Mike Spivey Oct 10 '11 at 21:45
@Mike: Thanks! I found the error; I had multiplied two terms instead of adding them. I have double checked the rest, too. –  robjohn Oct 10 '11 at 23:45
You're welcome, and nice work, by the way! –  Mike Spivey Oct 11 '11 at 0:07
Doing a numerical check, I found an error in the sixth order $\left(\frac{1}{n^2}\right)$ term. Now things seem correct. The error term is approximately $\frac{1}{300n^{5/2}}$. –  robjohn Oct 11 '11 at 13:51

A related result was given in the problems column of the American Mathematical Monthly not too long ago. This is problem 11353 whose solution was published in the January 2010 issue.

Let $$g(s)=\int_0^\infty \left(1+{x\over s}\right)^se^{-x}\, dx-\sqrt{s\pi\over 2}.$$ Show that $g(s)$ decreases from $1$ to $2/3$ as $s$ ranges from $0$ to $\infty$.

Note that the exponent in the integral is $s$, not $s-1$.

-
Note that by-parts gives $$\int_0^\infty\left(1+\frac{x}{s}\right)^{s-1}e^{-x}dx=1+\int_0^\infty\left(1+\‌​frac{x}{s}\right)^se^{-x}dx.$$ –  anon Oct 10 '11 at 18:31
@anon: Since my answer gives $-\frac{1}{3}$, I checked and I believe that your limits on the boundary terms are switched. I get $$\int_0^\infty\left(1+\frac{x}{s}\right)^{s-1}e^{-x}dx=-1+\int_0^\infty\left(1+‌​\frac{x}{s}\right)^se^{-x}dx.$$ –  robjohn Oct 10 '11 at 21:20
@robjohn: whoops, you are correct. –  anon Oct 10 '11 at 21:26
@Byron: is their solution simpler in nature than mine? They needn't carry out as many terms as I did, but other than that, is the idea of theirs simpler? –  robjohn Oct 10 '11 at 21:27
@robjohn No, I wouldn't call their solution simple. It uses similar ideas to yours, but needs extra care in showing that $g(s)$ is decreasing. –  Byron Schmuland Oct 10 '11 at 21:39

Interesting. I've got a representation $$\mathcal{I}_n = n e^n \int_1^\infty t^{n-1} e^{- nt}\, dt$$ which can be obtained from yours by the change of variables $t=1+\frac xn$. After some fiddling one can get $$2\mathcal{I}_n= n e^n \int_0^\infty t^{n-1} e^{- nt}\, dt+o(\mathcal{I}_n)= n^{-n} e^n \Gamma(n+1)+\ldots=\sqrt{2\pi n}+\ldots.$$

-
Thank you, could you elaborate a little on the fiddling needed ? –  Sasha Oct 10 '11 at 15:49
Briefly it's like follows. Consider function $g_n(t)=n e^n t^{n-1}e^{-nt}$, so $\mathcal{I}_n=\int_1^\infty g_n(t)\, dt\$. The maximum of $g_n$ tends to $1$n as $n\to\infty$. For $\varepsilon\in(0,1)$ $\int_{[0,+\infty]\backslash [1-\varepsilon,1+\varepsilon]\ }g_n(t)\, dt=o(1)\$, $n\to\infty\$. So it is enough to consider $\int_{1-\varepsilon}^{1+\varepsilon}g_n(t)$. Also $g(1-t)=e^{2 n t}\left(\frac{1-t}{1+t}\right)^{n-1}g(1+t)\ \;$. The factor of $g$ in the rhs is small for small values of $t$ so the graphic of $g(1+t)$ is sort of symmetric around $t=0$. –  Andrew Oct 10 '11 at 16:54
Hence $$\int_{0}^{\varepsilon}g_n(1-t)=\int_0^{\varepsilon}g_n(1+t)+ \int_0^{\varepsilon}\left(1-e^{2 n t}\left(\frac{1-t}{1+t}\right)^{n-1}\right)g(1+t)=$$ $$\int_0^{\varepsilon}g_n(1+t)+O(\mathcal{I}_n).$$ –  Andrew Oct 10 '11 at 16:54

I shifted the function by a unit since it won't effect the asymptotics and I'd like the global maximum to occur at $x=0$.

$$\mathcal{I}_n \sim \int^{\infty}_0 \left( 1 + \frac{x-1}{n} \right)^{n-1} e^{-(x-1) } dx$$

$$\left( 1 + \frac{ x-1}{n} \right)^{n-1} e^{-(x-1) } = e \left( 1 - \frac{1}{n} \right)^{n-1} \left( 1 - \frac{x^2}{2(n-1)} + \cdots \right)$$

$$\approx e \left(1 - \frac{1}{n} \right)^{n-1} \exp\left(\frac{-x^2}{2(n-1)} \right)$$

so $$\mathcal{I}_n \sim e\left( 1 -\frac{1}{n}\right)^{n-1} \int^{\infty}_0 \exp\left( \frac{-x^2}{2(n-1)} \right) dx$$

$$= e\left( 1 -\frac{1}{n}\right)^{n-1} \sqrt{\pi(n-1)/2} \sim \sqrt{\pi n/2}$$

-
But the fist integral diverges for all $n$ (for $x \to \infty$) –  leonbloy Oct 10 '11 at 15:48
@RagibZaman Do you mean to write $\left(1 + \frac{\vert x-1\vert}{n}\right)^{n-1} \exp( - \vert x-1 \vert )$ ? Otherwise the first line contains a divergent integral for finite $n$. –  Sasha Oct 10 '11 at 15:48
Sorry, I hadn't noticed that. Of course you are correct @Sasha, I will correct it now. –  Ragib Zaman Oct 10 '11 at 15:51
The easiest fix up ended up being just to integrate over the positive reals, so I just did that in the end, @Sasha. –  Ragib Zaman Oct 10 '11 at 15:56
@Ragib, I wonder if this is meant as a proof, or as an indication of what causes the asymptotics of $I_n$. –  Did Oct 10 '11 at 17:56