Residue theorem:When a singularity on the circle (not inside the circle)
Solution 1:
Your integral can be written as $$ \int_0^{\pi}\sin^2(\theta)\sec^3(\theta)d\theta = \frac{1}{2}\int_0^{2\pi}\sin^2(\theta)\sec^3(\theta)d\theta = i\int_C\frac{(z^2-1)^2}{(z^2+1)^3}dz $$ Taking the following contour:
Then \begin{align} \int_0^{\pi}\sin^2(\theta)\sec^3(\theta)d\theta &= \frac{1}{2}\int_0^{2\pi}\sin^2(\theta)\sec^3(\theta)d\theta\\ & = i\int_C\frac{(z^2-1)^2}{(z^2+1)^3}dz\\ & = i\pi\sum\text{Res}\\ & = i\pi\biggl[\lim_{z\to i}\frac{d^2}{dz^2}(z-i)^3\frac{(z^2-1)^2}{(z^2+1)^3} + \lim_{z\to -i}\frac{d^2}{dz^2}(z+i)^3\frac{(z^2-1)^2}{(z^2+1)^3}\biggr] \end{align}