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.
 A: We assume that $a$ and $b$ are real-valued and positive-valued parameters.
Let $z=e^{it}$ so that $\cos t = \frac12(z+z^{-1})$, $\sin t=\frac1{2i}(z-z^{-1})$, $dt=dz/iz$ and $t$ goes from $0$ to $2\pi$.  Then, 
$$\begin{align}
\int_0^{2\pi} \frac{dt}{a^2\cos^2 t+b^2\sin^2t}&=\oint_C \frac{1}{a^2\frac14(z+z^{-1})^2-b^2\frac14(z-z^{-1})^2}\frac{dz}{iz}\\\\
&=-\frac{4i}{a^2-b^2}\oint_C\frac{zdz}{z^4+2\frac{a^2+b^2}{a^2-b^2}+1}
\end{align}$$ 
where $C$ is the unit circle.  Roots of the denominator are at $\pm i \sqrt{\frac{a-b}{a+b}}$ and $\pm i \sqrt{\frac{a+b}{a-b}}$.  For $a>b$, the roots inside the unit circle are $\pm i \sqrt{\frac{a-b}{a+b}}$.  The residues of the integrand are easy to compute and both are given by 
$$\frac12\frac{a^2-b^2}{4ab}.$$
Thus, we have that
$$\begin{align}
\int_0^{2\pi} \frac{dt}{a^2\cos^2 t+b^2\sin^2t}&=-\frac{4i}{a^2-b^2}2\pi i\sum \text{Res}\left(\frac{z}{z^4+2\frac{a^2+b^2}{a^2-b^2}+1}\right)\\\\
&=-\frac{4i}{a^2-b^2}2\pi i\left(2\frac12\frac{a^2-b^2}{4ab}\right)\\\\
&=\frac{2\pi}{ab}
\end{align}$$ 
as was to be shown.  If $b>a$, symmetry considerations show that the value of the integral is unchanged.

NOTE:
This integral can be evaluated without appeal to contour integration.  We see that 
$$\begin{align}
\int_0^{2\pi} \frac{dt}{a^2\cos^2 t+b^2\sin^2t}&=\frac{4}{a^2}\int_0^{\pi/2}\frac{\sec^2 t}{1+\frac{b^2}{a^2}\tan^2 t}\,dt\\\\
&=\frac{4}{ab}\int_0^{\infty}\frac{du}{1+u^2}\\\\
&=\frac{4}{ab}\frac{\pi}{2}\\\\
&=\frac{2\pi}{ab}
\end{align}$$
as expected!!

NOTE 2:
If one chooses to parameterize with an ellipse, then we let $z=a\cos t+ib\sin t$ and $dz=(-a\sin t+ib \cos t)dt$.  Note that the integral around the ellipse $C'$ is  
$$\begin{align}
\int_0^{2\pi}\frac{dt}{a^2 \cos^2t+b^2\sin^2t}&=\oint_{C'}\frac{1}{ab}\text{Im}\left(\frac{\bar z\,dz}{|z|^2}\right)\\\\
&=\oint_{C'}\frac{1}{ab}\text{Im}\left(\frac{dz}{z}\right)\\\\
&=\frac{1}{ab}\text{Im}\left(2\pi i\right)\\\\
&=\frac{2\pi}{ab}
\end{align}$$
again as expected.
A: 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).
