Integration reduction formula How to create a reduction formula for the integral$$\int x \cos^n x \;\mathrm{d}x$$
I have tried everything i could think of, but I'm not even close to solving it. Really need help.
 A: Let $I_n$ be the integral
$$I_n=\int x\cos^n(x)\,dx$$
Then, we have
$$\begin{align}
I_{n+2}&=\int x\cos^2(x)\cos^n(x)\,dx\\\\
&=I_n-\int x\sin^2(x)\cos^n(x)\,dx\tag 1
\end{align}$$
Integrating by parts the integral on the right-hand side of $(1)$ with $u=x\sin(x)$ and $v=-\frac{\cos^{n+1}(x)}{n+1}$ yields
$$\begin{align}
I_{n+2}&=I_n-\left(x\sin(x)\left(-\frac{\cos^{n+1}(x)}{n+1}\right)+\frac{1}{n+1}\int (x\cos(x)+\sin(x))\cos^{n+1}(x)\,dx\right)\\\\
&=I_n+\frac{x\sin(x)\cos^{n+1}(x)}{n+1}-\frac{1}{n+1}I_{n+2}+\frac{\cos^{n+2}(x)}{(n+1)(n+2)}\\\\
&=\frac{n+1}{n+2}I_n+\frac{x\sin(x)\cos^{n+1}(x)}{n+2}+\frac{\cos^{n+2}(x)}{(n+2)^2}
\end{align}$$
A: Hint:
A reduction formula for $$\int  \cos^n x \;\mathrm{d}x$$
is  $$\int \frac{\cos^{n-1}(x)\sin(x)}{n}$$
The additional 'x' term would be an application of integration by parts.
A: By parts, integrating $\cos x$,
$$I_n:=\int x \cos^n x \,dx=x\sin x\cos^{n-1}x-\int\sin x\,(x\cos^{n-1}x)'\,dx
\\=x\sin x\cos^{n-1}x-\int\sin x\, \cos^{n-1}x\,dx+(n-1)\int x\sin^2x\,\cos^{n-2}x\,dx
\\=x\sin x\cos^{n-1}x+\frac1n\cos^nx+(n-1)\int x\,\cos^{n-2}x\,dx-(n-1)\int x\,\cos^nx\,dx
.$$
So, we get the recurrence relation
$$nI_n=x\sin x\cos^{n-1}x+\frac1n\cos^nx+(n-1)I_{n-2}.$$
A: You can actually evaluate this integral for general $n$ in terms of hypergeometric functions.
