Answer
$$\int x^2\sin xdx=-x^2\cos x+2\Big(x\sin x+\cos x\Big)+C$$
Work Step by Step
$$A=\int x^2\sin xdx$$
Set $u=x^2$ and $dv=\sin xdx$
Then we would have $du=2xdx$ and $v=-\cos x$
Using the formula $\int udv= uv-\int vdu$:
$$A=-x^2\cos x-\int2x(-\cos x)dx$$ $$A=-x^2\cos x+2\int x\cos xdx$$
We apply Integration by Parts one more time here.
Set $u=x$ and $dv=\cos xdx$
Then we would have $du=dx$ and $v=\sin x$
Using the formula $\int udv= uv-\int vdu$: $$A=-x^2\cos x+2\Big(x\sin x-\int \sin xdx\Big)$$ $$A=-x^2\cos x+2\Big(x\sin x-(-\cos x)\Big)+C$$ $$A=-x^2\cos x+2\Big(x\sin x+\cos x\Big)+C$$