Table of Contents
Integrating sin² x
$$ \int \sin^2{x}\,dx = \frac{x - \sin{x}\cos{x}}{2} + C $$
Using the Pythagorean identity
Integrate by parts using $u = \sin{x}, du = \cos{x}$ and $v = -\cos{x}, dv = \sin{x}$:
$$ \begin{align}
& \int \sin{x}\sin{x}\,dx = -\sin{x}\cos{x} - \int -\cos{x}\cos{x}\,dx
& \int \sin^2{x}\,dx = -\sin{x}\cos{x} + \int \cos^2{x}\,dx
\end{align} $$
Add $\int \sin{x}^2\,dx$ to both sides:
$$ 2\int \sin^2{x}\,dx = -\sin{x}\cos{x} + \int \cos^2{x}\,dx + \int \sin^2{x}\,dx $$
Apply integral linearity:
$$ 2\int \sin^2{x}\,dx = -\sin{x}\cos{x} + \int \left(\cos^2{x} + \sin^2{x}\right)\,dx $$
Apply the Pythagorean identity and divide both sides by 2:
$$ \begin{align}
2\int \sin^2{x}\,dx &= -\sin{x}\cos{x} + \int 1\,dx
&= -\sin{x}\cos{x} + x + C
\int \sin^2{x}\,dx &= \frac{x - \sin{x}\cos{x}}{2} + C
\end{align} $$
Using the double angle formula
<alert warning> Careful! This derivation differs from the one in Integrating cos² x by just a sign.</alert> Rewrite the integral using the double angle formula for the cosine:
$$ \int \sin^2{x}\,dx = \int \frac{1 - \cos{2x}}{2}\,dx $$
Substitute $u = 2x, du = 2\,dx$:
$$ \begin{align}
\int \frac{1 - \cos{2x}}{2}\,dx &= \int \frac{1 - \cos{u}}{2}\frac{1}{2}\,du
&= \frac{1}{4} \left(\int 1\,du - \int \cos{u}\,du\right)
&= \frac{u - \sin{u} + C}{4}
\end{align} $$
Substitute back and simplify:
$$ \begin{align}
\frac{u - \sin{u} + C}{4} &= \frac{2x - \sin{2x} + C}{4}
&= \frac{x - \frac{\sin{2x}}{2}}{2} + C
&= \frac{x - \sin{x}\cos{x}}{2} + C
\end{align} $$