# Is integration by parts the best method?

My integration techniques are rusty. If I wish to integrate the following function, I can do it by using integration by parts twice, but is this really the simplest way?

I wish to integrate the function $$f(x) = (x^2 - 2x + 1)(e^{-x})$$. Integrating by parts we get $$\int f(x)dx = (x^2 - 2x + 1)(-e^{-x}) - \int(2x-2)(-e^{-x})dx$$ In order to solve the last integral we must again do integration by parts to get $$\int(2x-2)(-e^{-x})dx = (2x-2)(e^{-x})-\int 2(e^{-x})dx$$ The final integral can then be solved directly and we get the final result, which is $$\int f(x)dx = -e^{-x}(x^2+1)$$ But is this the simplest way? Does this mean I need to use integration by parts $$n$$ times if I have a polynomium of $$n$$th degree? Or are there some tricks when a polynomium is multiplied by $$e^{-x}$$?

• The only "trick" I can think of is using a reduction formula but that's derived from integration by parts. – Justin Stevenson Dec 10 '18 at 1:28

A trick for such integrals:

• If $$f(x)$$ is of the form $$f(x)$$ = $$e^x$$ $$(g(x) + g\prime(x))$$, then $$\int f(x)$$ = $$e^x g(x)$$ + some constant.
• If $$f(x)$$ is of the form $$f(x)$$ = $$e^{-x}$$ $$(g\prime(x) - g(x))$$, then $$\int f(x)$$ = $$e^{-x}g(x)$$ + some constant.

The given question is of the second form. I am sure you can prove the trick so I am skipping it.

Integration by parts done fast This method speeds up the process, but other then this I don't know of any 'tricks'

"Best method" is subjective. But another way is to use Feynman's trick of differentiating under the integral sign.

First, note that the integral is $$\displaystyle \frac 1e \int (x-1)^2e^{-(x-1)}dx$$

Now consider the integral $$g(x,k) = \displaystyle \frac 1e \int e^{-k(x-1)}dx$$ and note that $$\displaystyle \frac{\partial{^2}}{\partial k^2}g(x,k) = \frac 1e \int (x-1)^2e^{-(x-1)}dx$$ when $$k=1$$.

$$g(x,k)$$ is trivial to compute, and the twice partial differentiation can be done with product rule without too much fuss.

EDIT (addendum): even if you were to use integration by parts twice, your life would be made easier by doing a substitution $$\displaystyle u = x-1$$, to make the integral $$\displaystyle \frac 1e \int u^2e^{-u} du$$, which is more tractable.