# compute: $\int_{0}^{1}e^x(1-x)^{100}dx$

I'm trying to compute: $\int_{0}^{1}e^x(1-x)^{100}dx$. I tried to use integration by parts but it didn't work out for me(since I need to do that 100 times, and obviously there's a shorter solution) , I substituted $(1-x)=u$ and got $e\int_0^1e^{-t}t^{100}$, again I can't do with that much. Any suggestion how should solve this integral?

Thanks a lot guys!

• Try for a Reduction Formula. For that, Parts is (are?) good. – André Nicolas Feb 15 '12 at 15:41
• Please expand on "it didn't work out for me"? Which result did you get -- in which way did that not work out? – hmakholm left over Monica Feb 15 '12 at 15:41
• I imagine the easiest thing to do is expand $e^{-t}t^{100}$ into a power series. – David Mitra Feb 15 '12 at 15:46
• Just as a side note: If all you want to do is estimate the integral, there's a nifty trick: $\int_0^1 e^x (1-x)^{100} \approx \int_0^1 e^x e^{-100x} \approx \int_0^{\infty} e^{-99x}=\frac{1}{99}$ that gets you within about 1% of the correct answer. – Kevin P. Costello Feb 15 '12 at 17:21
• My answer below is exact and in closed form, if you allow the floor function. – alex.jordan Feb 16 '12 at 1:45

## 10 Answers

For what it's worth:

Write $$t^{100}e^{-t}=t^{100}(1-t+{t^2\over 2!}-{t^3\over 3!}-\cdots ) =t^{100}-t^{101}+{t^{102}\over 2!}-{t^{103}\over 3!}-\cdots$$

The above series is uniformly convergent on $[0,1]$; thus: \eqalign{ \int_0^1 e^{-t}t^{100}\,dt &=\sum_{n=0}^\infty \int_0^1 (-1)^n{t^{100+n}\over n!}\cr &=\sum_{n=0}^\infty (-1)^n{t^{101+n}\over({101+n}) n!}\Bigl|_0^1\cr &=\sum_{n=0}^\infty (-1)^n{1\over({101+n}) n!}. \cr }

• Worth a lot. very nice, Thanks! – Jozef Feb 15 '12 at 16:38

The integral is exactly the fractional part of $100!\,e$, or in other words $100!\ e-\lfloor100!\ e\rfloor\approx0.00999901019\ldots$

Apply integration by parts to the integral $I_n=\int_0^1e^{1-t}t^n\,dt$ (it's nicer not to pull the $e$ out to the front) and we find for $n\geq1$, $$I_n=-1+nI_{n-1}$$

This gives us $$I_{100}=-1+100[-1+99[-1+98[-1+\cdots+2[-1+1I_0]\cdots]]]$$

$I_0$ is a straightforward computation: $e-1$. So

This gives us $$I_{100}=-1+100[-1+99[-1+98[-1+\cdots+2[-1+e-1]\cdots]]]$$

Here is a nice observation. Once this is multiplied out, it (clearly?) simplifies to $100!\,e-N$ for some integer $N$. A graphical examination of the integral reveals that $I_{100}$ is somewhere between $0$ and $1$. (You could prove this using the fact that $e^{1-t}t^{100}=e^{1-t}tt^{99}\leq t^{99}$ on $[0,1]$.) So $N$ must equal the integer part of $100!\,e$, leaving $I_{100}$ to be the fractional part.

It's interesting to note that since $I_n\to0$ as $n\to\infty$, the fractional part of $n!\,e$ must approach zero; that is, $n!\,e$ gets closer and closer to being an integer. (Although I suppose that is obvious if we consider the usual series expansion for $e$.)

For computational purposes, we can use this to find a decimal approximation by throwing out the first $100$ terms or so (which are all integers) of the series expansion for $100!\, e$.

\begin{align} \int_0^1e^{1-t}t^{100}\,dt & = 100!\, e-\lfloor100!\,e\rfloor\\ & = \sum_{n=101}^{\infty}\frac{100!}{n!} \end{align}

This is the series that bgins has found with a slightly different argument. At first, this series converges faster than David Mitra's alternating series. It is correct to at least 17 decimal places after only 8 partial summands. David's requires 18 partial summands to get that much accuracy. However since both series have a ratio of order $1/n$ and David's series is alternating, I think that in the long run for very high accuracy demands, his series might be better.

• Very good answer! – Pedro Tamaroff Feb 16 '12 at 22:14

Use the formula $$\frac{d}{dx}\left(e^x\ \sum_{n\ge0}\ (-1)^n\ f^{(n)}(x)\right)=e^x\ f(x),$$ which holds if $f$ is a polynomial.

• @WillieWong Is it even true that this series $\sum (-1)^nf^{(n)}(x)$ necessarily converges for all real analytic functions? If it converges, then for any $x$, $\sum (-1)^nf^{(n)}(x)/n!$ converges, so that means the Taylor series around $x$ must have radius of convergence $\geq 1$. But we can easily construct real analytic functions that don't have radius of convergence $1$ at some $x$, can't we? Like $\frac{1}{1+4x^2}$, which has a radius of convergence $\frac{1}{2}$ at $x=0$. – Thomas Andrews Feb 15 '12 at 16:39
• Oops. @Thomas and Pierre-Yeves, I was too hasty at computing the decay condition needed. Deleting my previous comment. What I was trying to say is that "which holds if $f$ is a polynomial" can be replaced by a suitable convergence condition, and that the sum doesn't really have to terminate. Sorry! – Willie Wong Feb 16 '12 at 8:52

You could use integration by parts. You will end up with a recursion, like this:

$$\int\limits_0^1 {{e^{ - x}}{x^n}dx = \left[ { - {e^{ - x}}{x^n}} \right]_0^1} + n\int\limits_0^1 {{e^{ - x}}} {x^{n - 1}}dx$$ $${I_n} = -\frac{1}{e} + n{I_{n - 1}}$$

where

$$\int\limits_0^1 {{e^{ - t}}{t^n}dt} = {I_n}$$

Using it sufficient times you'll end up with your result.

• Thanks! sadly solving this exercise it's not up my choice :) – Jozef Feb 15 '12 at 16:29
• You should use integration by parts... Actually this is not necessary. // Unless I am mistaken, the value of $I_n$ that you propose is negative, you might want to modify this. – Did Feb 15 '12 at 22:54
• @DidierPiau I used $$\int\limits_0^1 {{e^{ - x}}{x^n}dx = \left[ { - {e^{ - x}}{x^n}} \right]_0^1} + \int\limits_0^1 {{e^{ - x}}n} {x^{n - 1}}dx$$ – Pedro Tamaroff Feb 15 '12 at 23:08

Substitute $1-x = t$ , so :

$I= -e \int \limits_1^0 e^{-t} \cdot t^{100}\,dt =e \int \limits_0^1 e^{-t} \cdot t^{100}\,dt$

Now substitute : $-t=s$ , so :

$I= -e \int \limits_0^{-1} e^{s} \cdot s^{100}\,ds = e \int \limits_{-1}^{0} e^{s} \cdot s^{100}\,ds$

This integral you can solve using Integration by parts several times .For start choose :

$u = s^{100}~$ , and $dv = e^s ds$

As already said, this is $I_n$ for $n=100$, where $$I_n=\int_0^1x^n\mathrm e^{1-x}\mathrm dx.$$ To compute $I_n$ for every $n\geqslant0$ at once, one can group these in a series, that is, consider, for every $s$ small enough, $$\sum_{n\geqslant0}\frac{s^n}{n!}I_n=\int_0^1\sum_{n\geqslant0}\frac{s^n}{n!}x^n\mathrm e^{1-x}\mathrm dx=\int_0^1\mathrm e^{1-x(1-s)}\mathrm dx=\frac{\mathrm e-\mathrm e^{s}}{1-s}.$$ The expansion of the first part of the RHS is $$\frac{\mathrm e}{1-s}=\sum\limits_{n\geqslant0}\mathrm es^n.$$ As regards the second part, one knows that $$\mathrm e^s\cdot\frac1{1-s}=\left(\sum\limits_{n\geqslant0}\frac{s^n}{n!}\right)\cdot\left(\sum\limits_{n\geqslant0}s^n\right),$$ whose coefficient of $s^n$ is $$\sum\limits_{k=0}^n\frac1{k!}.$$ Putting all these together yields $$\frac{I_n}{n!}=\mathrm e-\sum\limits_{k=0}^n\frac1{k!}=\sum\limits_{k=0}^{+\infty}\frac1{k!}-\sum\limits_{k=0}^n\frac1{k!}=\sum\limits_{k\geqslant n+1}\frac1{k!},$$ and finally, $$I_n=\sum\limits_{k\geqslant1}\frac{n!}{(n+k)!},$$ To get an approximate value of $I_n$, one can proceed as follows. Keeping only the first term of the series in the RHS yields a lower bound. Replacing the $k$th term by $\frac1{(n+1)^k}$ and summing the resulting series yields an upper bound. These read $$\frac1{n+1}\lt I_n\lt\frac1n.$$

• And more generally, $$\frac{1}{n+1} + \frac{1}{(n+1)(n+2)} + \ldots + \frac{1}{(n+1)(n+2)\ldots(n+k)} < I_n < \frac{1}{n+1}+\frac{1}{(n+1)(n+2)} + \ldots + \frac{1}{(n+1)(n+2)\ldots(n+k-1)} + \frac{1}{(n+1)(n+2)\ldots(n+k-2)(n+k-1)^2}$$ – Robert Israel Feb 17 '12 at 1:06

Define $$I_n = e\int_0^1 e^{-t} t^n dt$$

We have (integration by part) $I_n=n I_{n-1} - 1$, and $I_0 = e-1$.

Write $I_n$ as $a_n e - b_n$, with $a_n$ and $b_n$ rational numbers. We have $a_n = n a_{n-1}$ and $b_n = n b_{n-1} +1$, with $a_0=1=b_0=1$.

So obviously, $a_n = n!$. Way less obviously, we have $b_n = A000522(n)$. See the [OIES]1 page for generating series and other forms for $b_n$. The recurrence in itself is a very nice form, it allows the use of fast algorithms to compute a lot of terms. It also allows for asymptotic analysis.

So in the end, $$e\int_0^1 e^{-t} t^n dt = n! e - A000522(n)$$

Computer easily find that $b_{100} = A000522(100)$ is 2536869555601272974152707482122802204451475785662981422327751859874492\ 5390838644651894048542515204979326740773232800349360951349984969417670\ 9764490323163992001

Bonus : the factorization of $b_{100}$ :

{{59, 1}, {197, 1}, {281, 1}, {617, 1}, {6791290111, 1}, {29565843698156503, 1}, {42933474506607537350507, 1}, {146032600411218505211021315344688241113203163378586255678583083\ 99982138258246286181319177385766944701, 1}}

With $t=1-x,~dt=-dx$, the integral $$I=\int_{0}^{1}e^x(1-x)^{100}dx=e\int_{0}^{1}t^{100}e^{-t}dt=e\;I_{100}$$ can be expressed in terms of $I_n=\int_{0}^{1}t^{n}e^{-t}dt$. Using integration by parts with $u=t^n,~du=nt^{n-1}dt$ and $v=-e^{-t},~dv=e^{-t}dt$, we find for $n>0$ $$I_n =\int_{0}^{1}t^{n}e^{-t}dt =\left[-t^ne^{-t}\right]_0^1 +n\int_{0}^{1}t^{n-1}e^{-t}dt =-\frac1e+nI_{n-1}$$ while $I_0=1-\frac1e$, since at the lower endpoint, $t^0=1$ does not vanish. Unraveling the recursion, we find $$I_n=n!\left(1-\frac1e\;\sum_{k=0}^n\frac1{k!}\right) =\frac{n!}{e}\left(e-\sum_{k=0}^n\frac1{k!}\right)$$ $$=\frac{n!}{e}\sum_{k=n+1}^\infty\frac1{k!} %=\frac1e\sum_{k=n+1}^\infty\frac{n!}{k!}% (hidden) extra step! =\frac1e\sum_{k=1}^\infty\frac{n!}{(n+k)!}$$ which can be bounded thus: $$\frac{e^{-1}}{n+1} <I_n <\frac1e\sum_{k=1}^\infty\frac1{n^k} =\frac{e^{-1}}{n-1}$$ In particular, $$I=e\;I_{100} =\sum_{k=1}^\infty\frac{100!}{(100+k)!} =\frac1{101} +\frac1{101\cdot102} +\frac1{101\cdot102\cdot103} +\cdots$$ Numerically, this agrees with David Mitra's more elegant solution,

\eqalign{ I_n &=\sum_{k=0}^\infty {(-1)^k\over k!} \int_0^1 t^{n+k} dt \cr &=\sum_{k=0}^\infty {(-1)^k\over (n+k+1)k!}. \cr } I offer only some numerical evidence of this from Sage (which used maxima for at least the third quantity).

x=var('x')
I=integral(e^x*(1-x)^100,x,0,1)
I.n(digits=400)


0.009999010191094737330783479071750558784854694330\ 66671978145864533161714326816356034370681432918468\ 53285140817781582051413229186884063403403557977080\ 02120596655485207781703353097131323526778542109794\ 17015925291075182530361953938643022940937197666661\ 05165157555781181237126456446981437647360344459677\ 36642319892827301897254303584248930056503030250811\ 27060937927312963829104793337147051891405375697835

k = var('k')
I1 = sum(factorial(100)/factorial(100+k), k, 1, infinity)
I1.n(digits=396) # sum of positive terms


0.009999010191094737330783479071750558784854694330\ 66671978145864533161714326816356034370681432918468\ 53285140817781582051413229186884063403403557977080\ 02120596655485207781703353097131323526778542109794\ 17015925291075182530361953938643022940937197666661\ 05165157555781181237126456446981437647360344459677\ 36642319892827301897254303584248930056503030250811\ 27060937927312963829104793337147051891405375697835

# sum is to 1000 because summing to infinity took too long
I2=e*sum((-1)^k/factorial(k)/(k+101), k, 0, 1000); I2.n(digits=396)
I2.n(digits=396) # alternating series


0.009999010191094737330783479071750558784854694330\ 66671978145864533161714326816356034370681432918468\ 53285140817781582051413229186884063403403557977080\ 02120596655485207781703353097131323526778542109794\ 17015925291075182530361953938643022940938823909717\ 30629190237480312082277049371942004495735825187534\ 58710947176445868284110586963289380133420798065473\ 61761071441791460666209221052877877060247573885386

We can see that the third quantity, the more elegantly derived alternating series, as it was calculated above, differs from the first two (as they were calculated) by about $0.17\times10^{-238}$, i.e., its fifth row ends with $8823909717$ rather than $7197666661$.

• Shouldn't $(e-1)100!\sum_{k=0}^{100}\frac1{k!}\approx e(e-1)\cdot 100!$? – Thomas Andrews Feb 15 '12 at 16:24

For $n>-1$, consider $$I=\int\limits_{0}^{1}{\rm d}t\,e^{t}(1-t)^{n}.$$ With the substitution $u=1-t$ $$I=e \int\limits_{0}^{1}{\rm d}u{\hspace{1pt}} e^{-u}u^{n}=e \Bigg(\int\limits_{0}^{\infty}{\rm d}u{\hspace{1pt}} e^{-u}u^{n}-\int\limits_{1}^{\infty}{\rm d}u{\hspace{1pt}} e^{-u}u^{n}\Bigg)=e\big[\Gamma(n+1)-\Gamma(n+1,1)\big],$$ where $\Gamma(s)$ and $\Gamma(s,a)$ are the gamma and incomplete gamma functions respectively. For $n=100$ we have $e\big[\Gamma(101)-\Gamma(101,1)\big]\approx 0.009999$.

• If $u=1-x$ then how does $e^t$ become $e^{-u}$? Could you have intended $e^x$ and $dx$ where you wrote $e^t$ and $dt$? – Michael Hardy Feb 16 '12 at 1:57
• Thanks for catching that. I fixed it. – Tensor Feb 16 '12 at 2:22
• This is also explained following wolframalpha.com/input/?i=integrate+x%5Ek%2Fexp(x) - nice solution. – Bastian Ebeling Jun 18 '12 at 9:40

$$\int_0^1e^x(1-x)^{100}~dx$$

$$=\int_1^0e^{1-x}x^{100}~d(1-x)$$

$$=\int_0^1x^{100}e^{1-x}~dx$$

$$=-\left[\sum\limits_{n=0}^{100}\dfrac{100!x^ne^{1-x}}{n!}\right]_0^1$$ (can be obtained from https://en.wikipedia.org/wiki/List_of_integrals_of_exponential_functions#Integrals_of_polynomials)

$$=100!e-\sum\limits_{n=0}^{100}\dfrac{100!}{n!}$$