<s>[INST] Integrate $\int x\sin^2 (x) dx$ Integrate $\int x\sin^2 (x) dx$
My attempt:
$$=\int x\sin^2 (x) dx\\
=x^2\sin^2 (x) - \int 2\sin (x)\cos (x)x^2 dx\\
=x^2\sin^2 (x) - \int \sin (2x) x^2 dx.$$
 [/INST] Here is a method using tabular integration, where we use $\sin^2 x = \frac{1}{2} (1 - \cos 2x)$:
$$\begin{array}{c|c} D & I \\ \hline \color{red}{x} & \frac{1}{2} - \frac{1}{2} \cos(2x) \\ \hline  \color{blue}{1} & \color{red}{\frac{1}{2}x - \frac{1}{4} \sin(2x)} \\ \hline 0 & \color{blue}{\frac{1}{4}x^2 + \frac{1}{8} \cos(2x)} \end{array}$$
hence:
$$\int x \sin^2 (x) \ dx = \color{red}{+}x \left(\frac{1}{2}x - \frac{1}{4} \sin(2x) \right) \color{blue}{-}  \left(\frac{1}{4}x^2 + \frac{1}{8} \cos(2x) \right) +C$$
$$= \frac{1}{4}x^2 - \frac{1}{4} x \sin(2x) - \frac{1}{8} \cos(2x) +C.$$
</s>