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