# Integrate $(x^n)\sin x$, where $n$ is an arbitrary natural number

I know how to integrate, for example $x^2\sin x$ via integration by parts. But how would one approach $x^n\sin x$, where $n$ is an arbitrary natural number? Do I have have to use integration by parts $n$ times? How do I do this?

-
Do it by parts twice and you will then have a recurrence relation between $I_n$ and $I_{n-2}$, I bet. –  Claude Leibovici Jun 28 at 13:55
And since you know the first two terms, yo are done. You can check since you know the result for $n=2$. –  Claude Leibovici Jun 28 at 14:05
This answer might be useful: math.stackexchange.com/questions/70974/… –  Hans Lundmark Jun 28 at 14:17

## 1 Answer

Integrating two times by parts one can find the recursive relation $$\begin{array}{rcl} I_{n}(t)&=& \int^t x^n \sin(x)dx \\ &=& -t^{n}\cos(t)+n\int^t x^{n-1} \cos(x)dx\\ &=& -t^n\cos(t)+nt^{n-1}\sin(t)-n(n-1)I_{n-2}(t)\end{array}$$

-
I did the integration by parts twice and I have the recursive relation. Now what do I do with it? Am supposed to solve it for n? –  Adam Jun 28 at 14:16
You know $I_1$ and $I_2$, so there is no problem, you just apply the formula recursively until one of these terms appears (depending on the parity of $n$). Here's a general closed form: wolframalpha.com/input/?i=integrate+x%5Ensin%28x%29 –  Surb Jun 28 at 14:32