<s>[INST] Showing $ \int_0^{2 \pi } \frac{dt}{a^2 \cos^2 t + b^2 \sin^2 t} = \frac{2 \pi}{ab}$ The question:
Let $\gamma$ be a contour such that $0 \in I(\gamma),$ where $I$ is the interior of the contour. Show that 
$$\int_\gamma z^n \, \text{d}z = \begin{cases} 2\pi i & \text{if }  n = -1 \\ 0 & \text{otherwise} \end{cases}$$
By taking $\gamma$ as the ellipse
$$\{ (x,y) : \frac{x^2}{a^2} + \frac{y^2}{b^2} = 1 \},$$
show that $$ \int_0^{2 \pi } \frac{dt}{a^2 \cos^2 t + b^2 \sin^2 t} = \frac{2 \pi}{ab}.$$
The question's answer uses the Deformation theorem and the fact that the first integral has the given value if the contour is a unit circle. However, the two contours must not overlap, so it seems like this should only be true for a contour that either always has magnitude less than one or greater than one. In Mathematica, the final integral was true for the case that $a = 1.5$ and $b=0.4$. What am I missing?
Edit: The radius of the circle cancels in the integral if $n = -1$, so then it does hold irrespective of the radius.
 [/INST] Let us consider the ellipsis in the complex plane $z=a\cos t+ib\sin t$, $t \in [0,2\pi]$, from which $dz=(-a\sin t+ib\cos t)dt$, then
\begin{align}
&2\pi i=\int_\gamma z^{-1}dz=\int_0^{2\pi}\frac{-a\sin t+ib\cos t}{a\cos t+ib\sin t}dt=\\
&\qquad=\int_0^{2\pi}\frac{(b^2-a^2)\sin t \cos t+iab}{a^2\cos^2 t+b^2\sin^2 t}dt=\\
&\qquad(b^2-a^2)\int_0^{2\pi}\frac{\sin t \cos t}{a^2\cos^2 t+b^2\sin^2 t}dt+iab\int_0^{2\pi}\frac{1}{a^2\cos^2 t+b^2\sin^2 t}dt
\end{align}
from which the result (the first integral vanishes for symmetry reasons, or also because the first member is purely imaginary).
</s>