I want to calculate the integral $$I = \int_0^{2 \pi} \sin^2 \theta\ \cos^4 \theta\ d \theta$$ by converting it into a complex integral around the unit circle.
I use the identities $$\cos \theta = {1 \over 2} (e^{i \theta} + e^{-i \theta}),$$ $$\sin \theta = {1 \over 2 i} (e^{i \theta} - e^{-i \theta})$$ and let $$z = e^{i \theta}$$ to convert the integral to $$I = \oint_C ({1 \over 2 i} (z - {1 \over z}))^2 ({1 \over 2} (z + {1 \over z}))^4\ dz$$ $$=-{1 \over 64} \oint_C (z - {1 \over z})^2 (z + {1 \over z})^4\ dz$$ Then, to apply Cauchy's residue theorem, I note that the integrand has a single pole, which is at the origin ($z = 0$). The polynomial expansion of the integrand is $$z^6+2 z^4-z^2-4-{1\over z^2}+{2\over z^4}+{1\over z^6}$$ so this pole has a residue of $0$, as the expansion has no $z^{-1}$ term.
By the residue theorem, therefore, $$\oint_C (z - {1 \over z})^2 (z + {1 \over z})^4\ dz = 2 \pi i\ \text{Res}_{z=0} [(z - {1 \over z})^2 (z + {1 \over z})^4] = 0$$ which means that $$I = 0.$$
But this is obviously wrong. The real integral at the top is strictly non-negative, and is not always $0$, so its integral must be positive. (In fact, the integral is $\pi \over 8$.)
Where have I gone wrong in the complex analysis?
I thought $dz=i e^{i\theta}d\theta$ or $d\theta=\frac{dz}{i z}.$
EDIT: Added $i$ to the denominator.