I know that when using integration by substitution, one needs to be careful to use one-to-one substitution. However, the following integration bothers me:
$$\begin{align} \int_0^{2\pi}\sin^2\theta d\theta &= \int_0^{\pi}\sin^2\theta d\theta + \int_\pi^{2\pi}\sin^2\theta d\theta \quad \leftarrow u = \cos \theta, \;du = -\sin\theta d\theta\\ &= \int_{-1}^1-\sqrt{1-u^2}du+\int_{1}^{-1}-\sqrt{1-u^2}du \\ &= 0 \end{align}$$
What went wrong here? I divided the range so that $u = \cos \theta$ would be one-to-one but still, something weird happened. (I am feeling dumb right now, please help...)
$\sin \theta = \sqrt{1-\cos^{2} \theta}$ for $0 \le \theta \le \pi$ but $\sin \theta = -\sqrt{1-\cos^{2} \theta}$ for $\pi \le \theta \le 2\pi$. Considering this, you may wish to switch the sign of the second term of the second line, which shall give you the right answer.