Using Residue Theorem find $\displaystyle \int_0^{2\pi} \frac{1}{a^2\cos^2 t+b^2 \sin^2 t} dt \;; a,b>0$.
My Try:
So, I am going to use the ellipse $\Gamma = \{a\cos t+i b \sin t: 0\leq t\leq 2\pi\}$.
On $\Gamma$, $z=a\cos t+i b \sin t$, so $|z|^2=z\bar{z}=a^2\cos^2 t+b^2 \sin^2 t$.
Now, $dz=-a\sin t+i b \cos t dt$.
Hence, the integral becomes $\displaystyle \int_\Gamma \frac{dz}{z(iab+(\sin t \cos t)(b^2-a^2))}$. I know that $\displaystyle \int_\Gamma \frac{dz}{z}=2\pi i$. Now, how do I get rid of $\sin t \cos t$ part? I am stuck here. Can somebody please explain how?
Note that we have for $z=a\cos t+ib\sin t$,
$$\begin{align} \frac{1}{z}\,dz&=\frac{\bar z}{|z|^2}\,dz\\\\ &=\frac{\left(a\cos t-ib\sin t\right)}{a^2\cos^2 t+b^2\sin^2 t}\,\left(-a\sin t+ib\cos t\right)\,dt\\\\ &=\left(\frac{(b^2-a^2)\sin t\cos t}{a^2\cos^2 t+b^2\sin^2 t}\right)\,dt+i\left(\frac{ab}{a^2\cos^2 t+b^2\sin^2 t}\right)\,dt \end{align}$$
Therefore, we have
$$\begin{align}\int_0^{2\pi}\frac{1}{a^2\cos^2 t+b^2\sin^2 t}\,dt&=\frac{1}{ab}\text{Im}\left(\oint_C \frac{1}{z}\,dz\right) \tag 1\\\\ &=\frac{2\pi}{ab} \end{align}$$
where $C$ is the elliptical contour around the origin and we used the Residue Theorem to evaluate the integral on the right-hand side of $(1)$.