Trouble with a substitution I'm struggling to show that
$$ \int_{-1}^{1} \frac{(1-x^2)^{1/2}}{1+x^2} dx $$ 
to
$$ -\pi + \int_{-\pi}^{\pi} (1+\cos^2(\theta))^{-1}d\theta$$
with $x=\cos(\theta)$
I'm aware I'm missing something obvious but I end up with a stray $\sin(\theta)$

After the usual substitution, you get 
$$
\int \frac{\sqrt{1-x^2}}{1+x^2}dx = \int_0^\pi \frac{\sin^2\theta}{1+\cos^2 \theta}d\theta = \int_0^\pi \frac{1-\cos^2\theta}{1+\cos^2 \theta}d\theta = \int_0^\pi -1 + \frac{2}{1+\cos^2\theta} = \\-\pi + \int_{-\pi}^\pi \frac{1}{1+\cos^2\theta}d\theta.
$$
In the last steps I was using that 
$$
\frac{1-x^2}{1+x^2} = -1 + \frac{2}{1+x^2}
$$
and that $\frac{1}{1+\cos^2\theta}$ is an even function. 
