Answer
$$ - {x^2}\cos x + 2x\sin x + 2\cos x + C$$
Work Step by Step
$$\eqalign{
& \int {{x^2}\sin x} dx \cr
& {\text{substitute }}u = {x^2},{\text{ }}du = 2xdx \cr
& dv = \sin xdx,{\text{ }}v = - \cos x \cr
& {\text{ integration by parts}}{\text{, we have}} \cr
& \int {{x^2}\sin x} dx = - {x^2}\cos x - \int {\left( { - \cos xdx} \right)\left( {2xdx} \right)} \cr
& \int {{x^2}\sin x} dx = - {x^2}\cos x + 2\int {x\cos xdx} \cr
& {\text{substitute }}u = x,{\text{ }}du = dx \cr
& dv = \cos xdx,{\text{ }}v = \sin x \cr
& {\text{applying integration by parts}}{\text{, we have}} \cr
& \int {{x^2}\sin x} dx = - {x^2}\cos x + 2\left( {x\sin x - \int {\sin xdx} } \right) \cr
& \int {{x^2}\sin x} dx = - {x^2}\cos x + 2x\sin x - 2\int {\sin xdx} \cr
& {\text{integrating}} \cr
& \int {{x^2}\sin x} dx = - {x^2}\cos x + 2x\sin x - 2\left( { - \cos x} \right) + C \cr
& \int {{x^2}\sin x} dx = - {x^2}\cos x + 2x\sin x + 2\cos x + C \cr} $$