[Math] indefinite integral of $x^n\sin(x)$

integration

In school we have just started with integration by parts. We had examples like $∫x\sin(x)\,dx$ or $∫x^2\sin(x)\,dx$ I asked myself if it is possible to integrate terms like $∫x^{25}\sin(x)\,dx$ without doing integration by parts 25 times. I can't tell how exactly I did it, but I integrated some explicit terms and created this: $$\int x^n\sin x\,dx=\sum_{k=0}^{\lfloor n/2\rfloor}(-1)^{k+1}x^{n-2k}{n!\over(n-2k)!}\cos x+\sum_{k=0}^{\lfloor(n-1)/2\rfloor}(-1)^kx^{n-2k-1}{n!\over(n-2k-1)!}\sin x$$

with $n\in \Bbb N$.

I tested it a few times and I think that it is correct, but I don't have any idea how to prove it. How can I do that?

Best Answer

How about $$ \begin{eqnarray} c_n &=& a_n + i b_n = \int dx \ x^n e^{i x} = \int dx \ x^n \sin x + i \int dx \ x^n \cos x \\ &=& - i\int dx \ \left[\frac{d}{dx}\left(x^n e^{i x}\right) - n x^{n-1} e^{i x}\right] \\ &=& - i \left(x^n e^{i x} - n c_{n - 1}\right) \end{eqnarray} $$ where $a_n = {\mathcal{Re}} \left(c_n\right)$, $b_n = {\mathcal{Im}} \left(c_n\right)$, and there is a constant term added for each $c_n$. Presumably you could express this in terms of a sum that, hopefully, would agree with your result.

Related Question