Evaluate the following integrals:
$\int x^{2} \sin ^{2} x d x$
Let $I=\int x^{2} \sin ^{2} x d x$
We know that,
$\sin ^{2} x=\frac{1-\cos 2 x}{2}$
$=\int x^{2}\left(\frac{1-\cos 2 x}{2}\right) d x$
Using integration by parts,
$=\int \frac{x^{2}}{2} d x-\int \frac{x^{2} \cos 2 x}{2} d x$
$=\frac{x^{3}}{6}-\frac{1}{2}\left[\int x^{2} \cos 2 x d x\right]$
Using integration by parts in second integral,
$=\frac{x^{3}}{6}-\frac{1}{2}\left[x^{2} \int \cos 2 x d x-\int \frac{d}{d x} x^{2} \int \cos 2 x d x\right]$
$=\frac{x^{3}}{6}-\frac{1}{2}\left(x^{2} \frac{\sin 2 x}{2}\right)+\frac{1}{2} \times 2 \int x \frac{\sin 2 x}{2} d x$
Using integration by parts again,
$=\frac{x^{3}}{6}-\frac{1}{2}\left(x^{2} \frac{\sin 2 x}{2}\right)+\frac{1}{2}\left[x \int \sin 2 x d x-\int \frac{d}{d x} x \int \sin 2 x d x\right]$
$=\frac{x^{3}}{6}-\frac{1}{2}\left(x^{2} \frac{\sin 2 x}{2}\right)+\frac{1}{2}\left(\frac{x}{2}-\cos 2 x+\int \frac{\cos 2 x d x}{2}\right)$
$=\frac{x^{3}}{6}-\frac{1}{2}\left(x^{2} \frac{\sin 2 x}{2}\right)+\frac{1}{2}\left(-\frac{x}{2} \cos 2 x+\frac{1}{2} \frac{\sin 2 x}{2}\right)+c$
$=\frac{x^{3}}{6}-\frac{1}{4}\left(x^{2} \sin 2 x\right)-\frac{1}{4} x \cos 2 x+\frac{1}{8} \sin 2 x+c$