Answer
$$x^{2} \sin x +2x \cos x-2 \sin x+C$$
Work Step by Step
Given
$$\int x^{2} \cos x d x$$
Use the rule
$$\int x^{n} \cos x d x=x^{n} \sin x-n \int x^{n-1} \sin x d x$$
Here $n=2$, then
\begin{aligned}
\int x^{2} \cos x d x=x^{2} \sin x-2 \int x \sin x d
\end{aligned}
To evaluate $\displaystyle\int x \sin x d x$, use
$$\int x^{n} \sin x d x=-x^{n} \cos x+n \int x^{n-1} \cos x d x$$
Here $n=1$ and
\begin{aligned} \int x\cos x d x&=-x \cos x+ \int \cos x d x\\
&=-x \cos x+ \sin x+C \end{aligned}
It follows that
\begin{aligned}
\int x^{2} \sin x d x&=x^{2} \sin x-2 \int x \sin x d x\\
&=x^{2} \sin x +2x \cos x-2 \sin x+C
\end{aligned}