$$\int x^5 e^x\,\mathrm{d}x$$
Is there another, more efficient way to solve this integral that is not integration by parts?
$$\int x^5 e^x\,\mathrm{d}x$$
Is there another, more efficient way to solve this integral that is not integration by parts?
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}$
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.
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, $$
where
$$ a_k = (-1)^{n-k}\frac{n!}{k!}. $$
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.
$\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}
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)}$$
Then:
$$\int x^{m}e^{x}dx = e^{x}\left\{\sum_{n=0}^{m}(-1)^{n}\dfrac{m!}{(m-n)!}x^{(m-n)}\right\} + C$$