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 x d x=\sin x$ and $\frac{d}{d x} x^{n}=n x^{n-1}$
$=x^{2} \sin x-\int 2 x \sin x d x$
$=x^{2} \sin x-2 \int x \sin x d x$
We know that, $\int \sin x d x=-\cos x$
$=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$