Integration of $x^2 \sin(x)$ by parts How would I integrate the following?
$$\int_0^{\pi/2} x^2\sin(x)\,dx$$
I did $u=x^2$ and $dv=\sin(x)$
I got
$x^2-\cos(x)+2\int x\cos(x)\,dx.\quad$ I then used $u=x$ and $dv=\cos(x).$
I got 
$$x^2-\cos(x)+2[x-\sin(x)-\int\sin(x)]$$
then
$x^2-\cos(x)+-2 \sin(x)(x)-\cos(x)\Big|_0^{\pi/2} =\dfrac{\pi^2}{4}-0-2$

$u=x^2$ then $du=2xdx$ and $dv=\sin(x)dx$ then $v=-\cos(x)$. So integral becomes 
$=-(x^2\cos(x))+2\int x\cos(x)dx$
integration by parts for $$\int x\cos(x)dx$$ 
$x=u, dx=du$ and $dv=\cos(x)dx, v=\sin(x)$
then
$$=-(x^2\cos(x))-2\int \sin(x)dx+2x\sin(x)$$
the integral of $\sin x$ is $-\cos x$ so we get
$$=2\cos(x)-x^2\cos(x)+2x\sin(x)$$
