Answer
\[ - {x^2}\cos x - x\cos x - 2x\sin x - \sin x + \cos x + C\]
Work Step by Step
$$\eqalign{
& \int {\left( {{x^2} + x + 1} \right)\sin xdx} \cr
& {\text{Evaluate using tabular integration by parts}} \cr
& \frac{d}{{dx}}{\text{ }}\int {dx} \cr
& {x^2} + x + 1{\text{ + }}\sin x \cr
& {\text{ }}2x + 1{\text{ }} - {\text{ }}\cos x \cr
& {\text{ }}2{\text{ + }} - \sin x \cr
& {\text{ 0 }} - {\text{ }} - \cos x \cr
& {\text{Then,}} \cr
& = \left( {{x^2} + x + 1} \right)\left( - \right)\left( {\cos x} \right) + \left( {2x + 1} \right)\left( + \right)\left( { - \sin x} \right) + \left( 2 \right)\left( - \right)\left( { - \cos x} \right) + C \cr
& {\text{Simplifying}} \cr
& = - \left( {{x^2} + x + 1} \right)\cos x - \left( {2x + 1} \right)\sin x + 2\cos x + C \cr
& = - {x^2}\cos x - x\cos x - \cos x - 2x\sin x - \sin x + 2\cos x + C \cr
& = - {x^2}\cos x - x\cos x - 2x\sin x - \sin x + \cos x + C \cr} $$