Question:
Evaluate the following integrals:
$\int x \cos ^{2} x d x$
Solution:
Let $I=\int x \cos ^{2} x d x$
Using integration by parts,
$I=x \int \cos ^{2} x d x-\int \frac{d}{d x} x \int \cos ^{2} x d x$
We know that, $\cos ^{2} x=\frac{\cos 2 x+1}{2}$
$=x \int\left[\frac{\cos 2 x+1}{2}\right] d x-\int\left[1 \int\left[\frac{\cos 2 x+1}{2}\right] d x\right] d x$
We know that,
$\int \cos n x=\frac{\sin n x}{n}$
$=\frac{x}{2}\left[\frac{\sin 2 x}{2}+x\right]-\frac{1}{2} \int\left(x+\frac{\sin 2 x}{2}\right) d x$
$=\frac{x}{4} \sin 2 x+\frac{x^{2}}{2}-\frac{1}{2} \times \frac{x^{2}}{2}-\frac{1}{4}\left(-\frac{\cos 2 x}{2}\right)+c$
$I=\frac{x}{4} \sin 2 x+\frac{x^{2}}{4}+\frac{1}{8} \cos 2 x+c$