<s>[INST] Computing $ \int_0^{2\pi} \frac{1}{a^2\cos^2 t+b^2 \sin^2 t} dt \;; a,b>0$. 
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?
 [/INST] Enforcing the change of variables $x= t-π$  leads to 
$$I=\int_{0}^{2\pi} \frac{dx}{a^2\sin^2x+b^2\cos^2x}=2\int_{0}^{\pi} \frac{dx}{a^2\sin^2x+b^2\cos^2x}=4\int_{0}^{\pi/2} \frac{dx}{a^2\sin^2x+b^2\cos^2x}$$
and we have  \begin{align}\frac{1}{a^2\sin^2x+b^2\cos^2x}&=\frac1{ab}\cdot\frac{b^2\cos^2x}{b^2\cos^2x+a^2\sin^2x}\cdot\frac{a}{b\cos^2x}\\&=\frac1{ab}\cdot\frac1{1+\left(\frac ab \tan x\right)^2}\cdot \frac a{b\cos^2x}\\&=\frac1{ab}\left[\arctan{\left(\frac ab\tan x\right)}\right]'\end{align}

$$I=4\int_{0}^{\pi/2}\frac1{ab}\left[\arctan{\left(\frac ab\tan x\right)}\right]'dx = \frac{2π}{ab} $$

</s>