About integrating $\sin^2 x$ by parts This is about that old chestnut, $\newcommand{\d}{\mathrm{d}} \int \sin^2 x\,\d x$. 
OK, I know that ordinarily you're supposed to use the identity $\sin^2 x = (1 - \cos 2x)/2$ and integrating that is easy. But just for the heck of it, I tried using the $u$-$v$ substitution method (otherwise known as integration by parts).
$$ \int \sin^2 x\,\d x = \int \sin x \sin x\,\d x $$
We can say $u=\sin x$ and $\d u=\cos x\,\d x$ while $\d v = \sin x\,\d x$ and $v = -\cos x$. When we put it all together: 
$$\int \sin^2 x\,\d x = u v - \int v\,\d u = -\sin x \cos x - \int -\cos^2 x\,\d x$$
and doing the same routine with $\cos^2 x$ we get $u = \cos x$, $\d u = -\sin x\,\d x$, $\d v = \cos x\,\d x $ and $v = -\sin x$, leading to:
$$\begin{align}
  \int \sin^2 x\,\d x = uv - \int v\,\d u
    &= -\sin x \cos x - (-\cos x \sin x - \int -\sin^2 x\,\d x) \\
    &= -\sin x \cos x + \sin x \cos x - \int \sin^2 x\,\d x
\end{align}$$
which eventually works out to
$$2\int \sin^2 x\,\d x = 0$$
So I wanted to get an idea why this didn't work. Maybe it's higher math and the why will be beyond me (I would think that might be the case), or maybe it's one of those proofs that looks absurdly simple when shown that I am just unaware of. 
 A: In the second $\newcommand{\d}{\mathrm{d}} \d v = \cos x\,\d x$, $v = \sin x$ rather than $-\sin x$, so your last equation simplifies to $0 = 0$.
A: In the second application of the $u$-$v$ method, there may be an error: If $\newcommand{\d}{\mathrm{d}} \d v = \cos x\,\d x$, then $v = \sin x$ and not $-\sin x$. Hence the $u$-$v$ method overall would produce
$$\int \sin^2 x\,\d x = −\sin x\cos x + \sin x\cos x + \int \sin^2 x\,\d x$$
resulting in circular reasoning: 
$$\int \sin^2 x\,\d x = \int \sin^2 x\,\d x$$
A: Let's look at the integral as follows:
If $u = \sin x$ and $\newcommand{\d}{\mathrm{d}} \d v = \sin x\,\d x$, then $\d u = \cos x\,\d x$ and $v = -\cos x$. So we have
$$\int \sin^2 x\,\d x = uv - \int v\,\d u = -\sin x\cos x + \int \cos^2 x\,\d x$$
If we add $\int \sin^2 x\,\d x$ to both sides, we get:
$$\begin{align}
  \int \sin^2 x\,\d x + \int \sin^2 x\,\d x
  &= -\frac{1}{2} \sin 2x + \int 1\,\d x \\
  &= -\frac{1}{2} \sin 2x + x + C
\end{align}$$
and so $$\int \sin^2 x\,\d x = -\frac{1}{4} \sin 2x + \frac{1}{2}x + C'$$
