# What is the reduction formula for $\int x\cos^nx\,dx$ such that $n \in \mathbb{Z}^+$?

I am pretty bad at deducing reduction formulas but I tried and I reached

$$\frac{1}{2}I_{n-2} + \frac{1}{2}(x\sin x\cos^{n-1}x+\sin^{n-1}x+\frac{1}{n} \cos^nx)$$ Which I tried testing for $n = 2$ and comparing my answer to the integral-calculator's, the calculator's answer was: $$\frac{2x(\sin(2x)+x)+\cos(2x)}{8} + C$$ And mine was: $$\frac{16x^2 + 16x\sin2x + 8\cos2x + 32\sin x}{64}$$

I can tell that I got a couple of things right, like the existence of a $\sin2x$ multiplied by a $x^1$, the existence of an $x^2$ free of any trigonometric functions, and a $\cos2x$ free of any $x$ all three with matching coefficients to the actual answer.

And then I have that annoying extra $sinx$ which I can't really trace. I know that comparing answers the way I am doing is kinda wrong, but I just couldn't help myself but see the similarities and feel close to the correct answer.

EDIT: here's the process as requested, I'll be skipping some parts because I need to sleep for uni. $$\int x cos^nx\ dx = \int x\cos^{n-2}x\cos^2x\ dx = \int x\cos^{n-2}(1-\sin^2x)dx$$ then solving that using the fact that $\sin^2x = \frac{1}{2}(1-\cos2x)$ I reached, $$\frac{1}{2} I_{n-2} + \frac{1}{2}\int x\cos^{n-2}\cos2x\ dx$$ Then, solving $\int x\cos^{n-2}\cos2x\ dx$ by parts, $u = x\cos^{n-2}x$ and $dv = \cos2x\ dx$ $$\int x\cos^{n-2}\cos2x\ dx = \frac{x\cos^{n-2}x\sin2x}{2}-\frac{1}{2}\int (-(n-1)x\sin^{n-3}x+\cos^{n-2}x)\sin2x\ dx$$

then, solving that last integral I got: $-2\sin^{n-1}x-\frac{2\cos^nx}{n}$ plugging in and simplifying the $\sin2x$ using $\sin2x = 2\sin x\cos x$ I got $$I_n = \frac{1}{2}I_{n-2} + \frac{1}{2}(x\sin x\cos^{n-1}x+\sin^{n-1}x+\frac{1}{n}\cos^nx)$$

• Please update the question to show your work, so we can identify what went wrong. – Dylan Dec 2 '17 at 23:19
• @Dylan Okay I edited the question adding more details to my process. It is not the complete process as I am kind of short on time so that's all I can do for now, but I will make sure to add the complete process hopefully by tomorrow if this isn't enough. – Eyad H. Dec 3 '17 at 0:57
• Your derivation of $du$ is not correct. See my answer – Dylan Dec 3 '17 at 4:30

The first step is correct. You made a mistake during integration by parts $$v = \frac{\sin 2x}{2} = \sin x\cos x, \quad du = \big( \cos^{n-2}x - x(n-2)\cos^{n-3}x\sin x \big)\ dx$$

Then \begin{align} \int x\cos^{n-2}x\sin 2x\ dx &= x\cos^{n-1}x\sin x - \int \cos^{n-1}x\sin x\ dx \\ &\quad + (n-2)\int x \cos^{n-2}x \sin^2 x\ dx \\ &= x\cos^{n-1}x\sin x + \frac{\cos^n x}{n} + (n-2)I_{n-2} - (n-2)I_n \end{align}

Altogether \begin{align} I_n &= \frac{1}{2}I_{n-2} + \frac{1}{2}\int x\cos^{n-2}x \sin 2x \ dx \\ &= \frac{n-1}{2}I_{n-2} - \frac{n-2}{2}I_n + \frac{1}{2}x\cos^{n-1}x\sin x + \frac{\cos^n x}{2n} \end{align}

which gives $$I_n = \frac{n-1}{n}I_{n-2} + \frac{1}{n}x\cos^{n-1}x\sin x + \frac{\cos^n x}{n^2}$$