$$\int x^5 e^x\,\mathrm{d}x$$

Is there another, more efficient way to solve this integral that is not integration by parts?

  • 2
    $\begingroup$ I don't see how this can be solved without IBP. If there is a way, I'd love to stand corrected. $\endgroup$
    – Kaj Hansen
    Jun 12, 2014 at 23:33
  • 13
    $\begingroup$ Get someone else to solve it for you. $\endgroup$
    – Pedro
    Jun 13, 2014 at 0:29
  • 3
    $\begingroup$ @PedroTamaroff Well, he's gotten that far! $\endgroup$
    – wchargin
    Jun 13, 2014 at 23:00
  • 2
    $\begingroup$ @WChargin I did not post this question for the sake of other people to do my work. I posted it so that I could educate myself by learning more enlightening methods of integration. $\endgroup$ Jun 14, 2014 at 2:38
  • 1
    $\begingroup$ @user155812 I jest, I jest. $\endgroup$
    – wchargin
    Jun 14, 2014 at 18:41

10 Answers 10


Notice that $\int e^{tx}dx=\frac{e^{tx}}{t}+C$. By differentiating in $t$ $5$-times and evaluating at $t=1$ we get:

$\int x^{5}e^{x}dx=x^{5}e^{x}-5x^{4}e^{x}+20x^{3}e^{x}-60x^{2}e^{x}+120xe^{x}-120e^{x}$

  • $\begingroup$ This was the method I was going to put forward! The best for last (well at least at the time of my viewing) +1. $\endgroup$
    – Chinny84
    Jun 12, 2014 at 23:39
  • $\begingroup$ @user7152 Sorry, I don't quite understand your method. Could you elaborate a bit? $\endgroup$
    – beep-boop
    Jun 12, 2014 at 23:58
  • $\begingroup$ I introduced a parameter $t$ which I can differentiate to produce the desired integral. I solve the integration problem with the parameter and differentiate both sides with respect to $t$. Formally I should probably make it a definite integral perform the differentiation using Leibnitz Integral Rule and infer the primitive from the result. $\endgroup$
    – user71352
    Jun 13, 2014 at 0:06
  • $\begingroup$ I think the only downside to this method is that it uses the quotient rule which I personally don't like. But you still get +1 because I think it can be helpful in other situations. $\endgroup$
    – IAmNoOne
    Jun 13, 2014 at 0:14
  • 1
    $\begingroup$ When I had to compute the derivative of the other side I made use of the generalized Leibniz rule and viewed the quotient $\frac{e^{tx}}{t}$ as $e^{tx}t^{-1}$. This seemed to speed up computations. $\endgroup$
    – user71352
    Jun 13, 2014 at 1:45

There is a very efficient operator approach.

Let $D$ be the differentiation operator, and $1/D$ its inverse (indefinite integration). Using the rule (see appendix) that $${1\over D}e^{ax}f(x)=e^{ax}{1\over D+a}f(x)$$ we get $$\begin{align}\int x^5 e^x\,\mathrm{d}x={1\over D}x^5e^x&=e^x\frac{1}{1+D}x^5 \\&=e^x\left(1-D+D^2-\cdots\right)x^5 \\ &=e^x\left(x^5-5x^4+20x^3-60x^2+120x-120\right)\end{align}$$

Appendix: Proof of Rule

First, we note that $$D\,e^{ax}f(x)=ae^{ax}f(x)+e^{ax}f'(x)=e^{ax}(D+a)f(x).$$ Therefore $$D\left[e^{ax}{1\over D+a}f(x)\right]=e^{ax}(D+a)\frac{1}{D+a}f(x)=e^{ax}f(x)=D\left[{1\over D}e^{ax}f(x)\right]$$

and the rule is "basically" proven :) ... There are still some points to clarify (justifying the treatment of $D$ as an operator, the use of the operator "power series", constants of integration, etc.) but that is the essence of the method.


The following is a close relative of integration by parts. Let us guess that the answer is $x^5e^x$. Differentiate to see whether we got lucky. We get $x^5e^x+5x^4e^x$. Too bad!

But maybe we can fix things by subtracting $5x^4e^x$, so our next guess is $x^5e^x -5x^4e^x$. Differentiate. We get $x^5e^x -20x^3e^x$. Maybe we can fix things by adding $20x^3e^x$. So our next guess is $x^5e^x-5x^4e^x +20x^3e^x$. Continue. It is soon over.

Remark: The general idea works nicely for $\sin(5x)e^{-3x}$, a standard integration by parts problem that causes me a great deal of trouble because of all the minus signs. But if we make a suitable guess, we can quickly arrive at the answer.

  • $\begingroup$ Though this method is neat, I'm not sure how efficient it would be. Still, +1. $\endgroup$ Jun 14, 2014 at 2:45
  • 1
    $\begingroup$ In general, "guess and adjust" is often efficient. For a more simple minded example, let's look at the integral of $(1-3x)^{14}$. We know that apart from a multiplicative constant it will be something like $(1-3x)^{15} +C$. Differentiation tells us that it is $-\frac{1}{45}(1-3x)^{15}+C$. $\endgroup$ Jun 14, 2014 at 2:51

You might guess that the antiderivative has the form

$$ (a_5 x^5 + a_4 x^4 + a_3 x^3 + a_2 x^2 + a_1 x + a_0)e^x + C, $$

then differentiate this to get

$$ \Bigl(a_5 x^5 + (5a_5 + a_4) x^4 + (4a_4 + a_3) x^3 + (3a_3 + a_2) x^2 + (2a_2 + a_1) x + a_1 + a_0\Big)e^x. $$

Setting the polynomial factor equal to $x^5$ renders the system of linear equations

$$ \begin{align} a_5 &= 1, \\ na_n + a_{n-1} &= 0, \quad n = 1,2,3,4,5, \end{align} $$

which can be solved iteratively for the coefficients $a_n$ to find that

$$ a_5 = 1, \quad a_4 = -5, \quad a_3 = 20, \quad a_2 = -60, \quad a_1 = 120, \quad a_0 = -120. $$

In general you can use this method to show that the antiderivative of $x^n e^x$ is

$$ e^x \sum_{k=0}^{n} a_k x^k + C, $$


$$ a_k = (-1)^{n-k}\frac{n!}{k!}. $$

  • $\begingroup$ How would you "guess" the form of the antiderivative? Is there some intuition that I'm missing? $\endgroup$ Jun 14, 2014 at 2:46
  • 1
    $\begingroup$ @user155812 $e^x$ always remains the same when integrating or deriving so the fact that the antiderivative is of the form $f(x) \cdot e^x$ is quite intuitive. The fact that $f(x)$ is a polynomial is quite intuitive given that, when integrating by parts, it will be obtained from the derivates of $x^5$ and of $x$ (the exponent). $\endgroup$
    – Bakuriu
    Jun 14, 2014 at 11:28
  • $\begingroup$ @user155812, Also, the product rule tells us why the degree of the polynomial doesn't change: $(p(x)e^x)' = (p(x)+p'(x))e^x$. The largest power of the polynomial will always stay the same when differentiating, so the same must be true when integrating. $\endgroup$ Jun 14, 2014 at 13:26

Another approach that gets all the integrals $\int x^n e^x\; dx$ at once is generating functions. Let $F_n(x) = \int x^n e^x\; dx$ (I won't worry about constants of integration). The exponential generating function of this sequence is $$ g(t,x) = \sum_{n=0}^\infty \dfrac{F_n(x)}{n!} t^n $$ Note that $g(t,0) = 1$. Interchange sum and integral (we assume we can do this):

$$g(t,x) = \int \sum_{n=0}^\infty \dfrac{x^n}{n!} t^n e^x \; dx = \int e^{xt + x}\; dx = \dfrac{e^{tx+x}}{t+1}$$ Now $$\dfrac{1}{t+1} e^{tx+x}= e^x \sum_{j=0}^\infty (-1)^j t^j\sum_{k=0}^\infty \dfrac{(t x)^k}{k!}$$ so by equating the coefficients of $t^n$ on both sides we get $$ \dfrac{F_n(x)}{n!} = e^x \sum_{k=0}^n (-1)^{n-k} \dfrac{x^k}{k!}$$


I don't know about more efficient, but one way is to use Taylor series (ignore if you've never heard of this before). Note that \begin{align*} \int x^5 e^x\,dx &= \int\left\{x^5\sum_{k=0}^\infty\frac{x^k}{k!}\right\}\,dx \\ &= \int\left\{\sum_{k=0}^\infty\frac{x^{k+5}}{k!}\right\}\,dx \\ &= \sum_{k=0}^\infty\frac{1}{k!}\int x^{k+5}\,dx \\ &= \sum_{k=0}^\infty\frac{1}{k!}\frac{x^{k+6}}{(k+6)} \\ &\overset{\circledast}{=} e^x\{x^5-5x^4+20x^3-60x^2+120x-120\}+120 \end{align*} Exercise for the interested: Prove the equality marked $\circledast$.


If you are ready to accept a single integration by parts, you can easily build a recurrence relation since $$I_n=\int x^n e^x~dx=x^n e^x- n I_{n-1}$$ with $I_0=e^x$


You're question asked if there is a more efficient way than integration by parts to solve the indefinite integral $\int x^5e^x dx$, and other users have provided good answers.

But in case you tacitly assumed that the answer to your question would pretty much be the same for definite integrals like $\int_a^b x^n e^{kx} dx$, I'd like to show for contrast that in this case there can be much more efficient methods than IBP for finding the integral.

For example, consider the integral $\int_0^\infty x^5 e^{-x}dx$. To find this integral, first evaluate $\int_0^\infty e^{-ax}dx$:

$$\int_0^\infty e^{-ax}dx=-\frac{e^{-ax}}{a}\bigg{|}_0^\infty=\frac{1}{a}.$$

Then just differentiate both sides with respect to $a$ five times to get:

$$-\int_0^\infty x^5 e^{-ax}dx=-\frac{120}{a^6}.$$

Finally, set $a=1$ and voila, the integral is $\int_0^\infty x^5 e^{-x}dx=120$. And all you had to do really was a single integration plus five differentiations.

  • $\begingroup$ You could just identify that integral as the Gamma function, placing its value at $5!=120$. Your trick of introducing the $a$, if replaced by $s$, is essentially the Laplace Transform. Upon consideration, this might be a good way to introduce students to the ideas of Laplace transforms, gamma functions, and their properties! +1 $\endgroup$
    – user142299
    Jun 13, 2014 at 1:52
  • $\begingroup$ @NotNotLogical My impression was that the questioner is an introductory Calc student, so I wanted to avoid name-dropping math concepts that might make his eyes glaze over. ;) But you're fit of course, the method I described can be developed much further. $\endgroup$
    – David H
    Jun 13, 2014 at 2:02
  • $\begingroup$ @DavidH I am far beyond introductory calculus. I just came across this problem in preparation for the MIT Integration Bee, and was curious if there was a quicker way to solve the integral that I might have been unaware of given that method efficiency is crucial in competition. Having said that, is there anything you would add now that you don't need to worry about "name-dropping math concepts that might make my eyes glaze over"? $\endgroup$ Jun 14, 2014 at 2:48

$\newcommand{\+}{^{\dagger}} \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\down}{\downarrow} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\isdiv}{\,\left.\right\vert\,} \newcommand{\ket}[1]{\left\vert #1\right\rangle} \newcommand{\ol}[1]{\overline{#1}} \newcommand{\pars}[1]{\left(\, #1 \,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert} \newcommand{\wt}[1]{\widetilde{#1}}$ \begin{align} &\color{#66f}{\large\int x^{5}\expo{x}\,\dd x} =\pars{\totald[5]{}{\mu}\int\expo{\mu x}\,\dd x\,}_{\,\mu\ =\ 1} =\left.\totald[5]{}{\mu}\pars{\expo{\mu x} \over \mu}\,\right\vert_{\,\mu\ =\ 1} \\[3mm]&=\left.\frac{x^5 e^{\mu x}}{\mu }-\frac{5 x^4 e^{\mu x}}{\mu ^2} +\frac{20 x^3 e^{\mu x}}{\mu ^3}-\frac{60 x^2 e^{\mu x}}{\mu ^4} -\frac{120 e^{\mu x}}{\mu ^6}+\frac{120 x e^{\mu x}}{\mu ^5} \,\right\vert_{\,\mu\ =\ 1} \\[3mm]&\color{#66f}{\large% =\left(x^5-5 x^4+20 x^3-60 x^2+120 x-120\right)\expo{x}} \end{align}

  • $\begingroup$ Felix! This is exactly the approach I was going to take. +1 ... You have to love Richard for making this "trick" so well known to physicists and others in applied math. -Mark $\endgroup$
    – Mark Viola
    May 31, 2016 at 18:13
  • $\begingroup$ @Dr.MV Richard has a lot of tricks. Some of them appear in his Quantum Electrodynamic book. Thanks. $\endgroup$ May 31, 2016 at 18:57

You can generalize the recursive integration by parts for $\int f(x)e^{ax} dx$. If you let $u=f(x)$ and $dv=e^{ax}$ and do integration by parts infinite times you can have:

\begin{align*} \int f(x)e^{ax}dx &= e^{ax}\left\{\sum_{n=0}^{\infty} \dfrac{(-1)^n}{a^{n+1}}f^{(n)}(x)\right\} + C\\ &= e^{ax}(\dfrac{1}{a}f(x)-\dfrac{1}{a^2}f'(x)+\dfrac{1}{a^3}f''(x)-... ) + C \end{align*}

Since your $f(x) = x^5$, differentiating it repeatedly will eventually lead to $0$ starting from $f^{(6)}(x)$. $$f(x) = x^5$$ $$f'(x) = 5x^4$$ $$f''(x) = (5)(4)x^3$$ $$f^{(3)}(x) = (5)(4)(3)x^2$$ $$f^{(4)}(x) = (5)(4)(3)(2)x^1$$ $$f^{(5)}(x) = (5)(4)(3)(2)(1)$$ $$f^{(6)}(x) = 0$$

Then: \begin{align*} \int x^{5}e^{x}dx &= e^{x}\left\{\sum_{n=0}^{\infty} (-1)^{n}f^{(n)}(x)\right\} + C\\ &= e^{x}[f(x)-f'(x)+f''(x)-f^{(3)}(x) + f^{(4)}(x)-f^{(5)}(x)] + C\\ &= e^{x}[x^5-5x^4+20x^3-60x^2 + 120x-120] + C \end{align*}

More generally if $f(x) = x^m$, for $n,m=0,1,2,...$ and $n \le m$ $$f^{(n)}(x) = \dfrac{m!}{(m-n)!}x^{(m-n)}$$


$$\int x^{m}e^{x}dx = e^{x}\left\{\sum_{n=0}^{m}(-1)^{n}\dfrac{m!}{(m-n)!}x^{(m-n)}\right\} + C$$


You must log in to answer this question.

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