Computing the indefinite integral $\int x^n \sin x\,dx$ $\newcommand{\term}[3]{
  \sum_{k=0}^{\lfloor #1/2 \rfloor} (-1)^{#2} x^{#3} \frac{n!}{(#3)!}
}$
I am trying to prove that for $n \in\mathbb N$,
$$
\int x^n \sin x \, dx
= \cos x \term{n}{k+1}{n-2k}
+ \sin x \term{(n-1)}{k}{n-2k-1}
$$
I started with differentiation, and this is what I got:
If we define $f(x)$ as
$$
f(x)
= \cos x \term{n}{k+1}{n-2k}
+ \sin x \term{n-1}{k}{n-2k-1}
$$
then we have
$$
\begin{align*}
f’(x)
&= \cos x \term{n}{k+1}{n-2k-1}
 - \sin x \term{n}{k+1}{n-2k} \\
&\qquad
 + \sin x \term{(n-1)}{k}{n-2k-2}
 + \cos x \term{(n-1)}{k}{n-2k-1} \\[8pt]
&= \cos x \left[
   \term{n}{k+1}{n-2k-1}
 + \term{(n-1)}{k}{n-2k-1}
\right] \\
&\qquad
 + \sin x \left[
   \term{(n-1)}{k}{n-2k-2}
 - \term{n}{k+1}{n-2k}
\right]
\end{align*}
$$
I don't know how to go on, because of the different limits of the sum with $\lfloor{n/2}\rfloor$ and $\lfloor{(n-1)/2}\rfloor$.

I finally got my proof with differentiation finished, too.
If
$$f(x) = \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$.
then
$$\begin{align}f'(x) &= \left(\sum_{k=0}^{\lfloor{n/2}\rfloor}(-1)^{k+1}x^{n-2k-1}{n!\over(n-2k-1)!}-\sum_{k=0}^{\lfloor{(n-1)/2}\rfloor}(-1)^{k+1}x^{n-2k-1}{n!\over(n-2k-1)!}\right)\cos x\\&{}\quad+\left(\sum_{k=0}^{\lfloor{(n-1)/2}\rfloor}(-1)^{k}x^{n-2k-2}{n!\over(n-2k-2)!}-\sum_{k=0}^{\lfloor{n/2}\rfloor}(-1)^{k+1}x^{n-2k}{n!\over(n-2k)!}\right)\sin x\end{align}$$
$$\begin{align}&= \left(\sum_{k=0}^{\lfloor{n/2}\rfloor}(-1)^{k+1}x^{n-2k-1}{n!\over(n-2k-1)!}-\sum_{k=0}^{\lfloor{(n-1)/2}\rfloor}(-1)^{k+1}x^{n-2k-1}{n!\over(n-2k-1)!}\right)\cos x\\&{}\quad+\left(\sum_{k=2}^{\lfloor{(n-1)/2}\rfloor+2}(-1)^{k}x^{n-2k+2}{n!\over(n-2k+2)!}-\sum_{k=1}^{\lfloor{n/2}\rfloor+1}(-1)^{k}x^{n-2k+2}{n!\over(n-2k+2)!}\right)\sin x\end{align}$$
$$\begin{align}&=\left(\sum_{k=0}^{\lfloor{n/2}\rfloor}(-1)^{k+1}x^{n-2k-1}{n!\over(n-2k-1)!}-\sum_{k=0}^{\lfloor{(n-1)/2}\rfloor}(-1)^{k+1}x^{n-2k-1}{n!\over(n-2k-1)!}\right)\cos x\\ &{}\quad+\left(\sum_{k=2}^{\lfloor{(n-1)/2}\rfloor+2}(-1)^{k}x^{n-2k+2}{n!\over(n-2k+2)!}-\sum_{k=2}^{\lfloor{n/2}\rfloor+1}(-1)^{k}x^{n-2k+2}{n!\over(n-2k+2)!}\right)\sin x\\ &{}\quad+ x^n\sin x\end{align}$$
Now we have to show that (1) $$ \sum_{k=0}^{\lfloor{n/2}\rfloor}(-1)^{k+1}x^{n-2k-1}{n!\over(n-2k-1)!}-\sum_{k=0}^{\lfloor{(n-1)/2}\rfloor}(-1)^{k+1}x^{n-2k-1}{n!\over(n-2k-1)!} = 0$$ and (2) $$\sum_{k=2}^{\lfloor{(n-1)/2}\rfloor+2}(-1)^{k}x^{n-2k+2}{n!\over(n-2k+2)!}-\sum_{k=2}^{\lfloor{n/2}\rfloor+1}(-1)^{k}x^{n-2k+2}{n!\over(n-2k+2)!}  = 0$$
For even numbers:
$$ \lfloor{n/2}\rfloor = n/2 $$
$$ \lfloor{(n-1)/2}\rfloor = (n-2)/2 $$
For odd numbers:
$$ \lfloor{n/2}\rfloor = (n-1)/2 $$
$$ \lfloor{(n-1)/2}\rfloor = (n-1)/2 $$
Also $n!$ is only defined for $$n\ge 0$$
(1) The odd case is trivial because of $$\lfloor{(n-1)/2}\rfloor = \lfloor{n/2}\rfloor$$
Even: We need $$ n -2k -1 \ge 0  $$ so
$$ k \le \lfloor{(n-1)/2}\rfloor = (n-2)/2 $$
We get:
$$ \sum_{k=0}^{(n-2)/2}(-1)^{k+1}x^{n-2k-1}{n!\over(n-2k-1)!}-\sum_{k=0}^{(n-2)/2}(-1)^{k+1}x^{n-2k-1}{n!\over(n-2k-1)!} = 0$$
With the same argumentation you can show (2).
It remains:
$$= 0\cos x+0\sin x+ x^n\sin x= x^n\sin x$$
