<s>[INST] Any hint to solve given integral $\int_0^{2{\pi}}{{d\theta}\over{a^2\cos^2\theta+b^2\sin^2\theta}}$? Show that for $ab>0$ $$\int_0^{2{\pi}}{{d\theta}\over{a^2\cos^2\theta+b^2\sin^2\theta}}={{2\pi}\over ab}$$
I'm not sure how to go about this. Any solutions or hints are greatly appreciated.
 [/INST] Let $z=e^{i\theta}$, then
\begin{align}
\int_0^{2\pi}\frac{d\theta}{a^2\cos^2\theta+b^2\sin^2\theta}&=\int_C \frac{1}{a^2\left(\frac{z+\frac{1}{z}}{2}\right)^2+b^2\left(\frac{z-\frac{1}{z}}{2i}\right)^2}\frac{dz}{iz}\\
&=\int_C \frac{-4iz}{(a^2-b^2)z^4+2(a^2+b^2)z^2 +(a^2-b^2)}dz,
\end{align}
where $C:|z|=1$. If $a=b$, then the integral becomes
$$
\int_C \frac{-i}{a^2 z}dz = 2\pi i \operatorname{Res}\left(-\frac{i}{a^2 z};0\right)=\frac{2\pi}{a^2}
$$
If $a\ne b$, Solve $(a^2-b^2)z^4+2(a^2+b^2)z^2+(a^2-b^2)=0$, then
$$
z^2=-\frac{a+b}{a-b}\text{ or }z^2=-\frac{a-b}{a+b}
$$
by quadratic formula. Since $\left|\frac{a+b}{a-b}\right|>1$ and $\left|\frac{a-b}{a+b}\right|<1$, there exist two simple poles inside $C$. Assuming $a>b>0$,
\begin{align}
\int_C \frac{-4iz}{(a^2-b^2)z^4+2(a^2+b^2)z^2 +(a^2-b^2)}dz &= 2\pi i\left(\operatorname{Res}\left(f;\sqrt{\frac{a-b}{a+b}}i\right)+\operatorname{Res}\left(f;-\sqrt{\frac{a-b}{a+b}}i\right)\right)
\end{align}
Compute residues:
\begin{align}
\operatorname{Res}\left(f;\sqrt{\frac{a-b}{a+b}}i\right) &= \frac{4\sqrt{\frac{a-b}{a+b}}}{a^2-b^2}\frac{1}{2\sqrt{\frac{a-b}{a+b}}i\left(-\frac{a-b}{a+b} + \frac{a+b}{a-b}\right)}\\
&=\frac{2}{4iab}=\frac{1}{2abi}
\end{align}
\begin{align}
\operatorname{Res}\left(f;-\sqrt{\frac{a-b}{a+b}}i\right) &=\frac{-4\sqrt{\frac{a-b}{a+b}}}{a^2-b^2}\frac{1}{-2\sqrt{\frac{a-b}{a+b}}i\left(-\frac{a-b}{a+b} + \frac{a+b}{a-b}\right)}\\
&=\frac{1}{2abi}
\end{align}
$$
\therefore \int_C \frac{-4iz}{(a^2-b^2)z^4+2(a^2+b^2)z^2 +(a^2-b^2)}dz = 2\pi i \left(\frac{1}{2abi}+\frac{1}{2abi}\right)=\frac{2\pi}{ab}
$$
We can get same conclusion when $b>a>0$.
</s>