Complex Integral on an ellipse around $\frac{1}{z}$ I'm working on the following problem:

Given $a,b>0$, define the path $\gamma$ whose image is an ellipse.
  $$\frac{x^2}{a^2}+\frac{y^2}{b^2} = 1$$ traced counterclockwise. By showing that $\int_{\gamma}z^{-1}dz = \int_{\gamma}z^{-1}dz$ for a suitable circle show that 
  $$\int_0^{2\pi}\frac{1}{a^2\cos^2{t}+b^2\sin^2{t}}dt=\frac{2\pi}{ab}$$

Attempt 1: Suppose $\gamma(t)= a \cos(t) + ib\sin(t)$ then we obtain $$\int_0^{2\pi}\frac{-a \sin(t) + ib\cos(t)}{a \cos(t) + ib\sin(t)}dt$$
I tired rationalizing the numerator but end up with $a^2+b^2$ in the numerator and a mess in the denominator. So I'm unable to obtain the LHS.
Attempt 2: Recognize $$\int_{\gamma}\frac{1}{z}=\int\frac{\gamma'(t)}{\gamma(t)}dt=\int\frac{\partial}{\partial t}\log(\gamma(t))dt$$ so that $$\frac{\partial}{\partial t}\log(\gamma(t)) = \frac{1}{a^2\cos^2{t}+b^2\sin^2{t}}$$
Integrating in $t$ and exponentiating to solve for $\gamma$ gives a mess. It doesn't reduce either. I think here, there also maybe an issue of branch cuts that I haven't considered carefully.
I also recognize that the denominator factors: $(a \cos(t) + ib\sin(t))(a \cos(t) - ib\sin(t))$ I haven't been able to use this information though.
Any ideas? Thanks!
 A: You should rationalize the denominator, not the numerator. You have
\begin{align}
\int_0^{2\pi}\frac{-a \sin t  + ib\cos t }{a \cos t  + ib\sin t }dt
&=\int_0^{2\pi}\frac{(-a \sin t  + ib\cos t )(a\cos t-ib\sin t)}{a^2\cos^2t+b^2\sin^2t}dt\\ \ \\
&=\int_0^{2\pi}\frac{(-a^2+b^2)\sin t\cos t+iab}{a^2\cos^2t+b^2\sin^2t}dt\\ \ \\
\end{align}
Now is the time to use the suggestion: this integral will be equal to $\int_{\gamma'}\frac1z\,dz$ if $\gamma'$ is small enough and surrounds the origin. So take $\gamma'$ to be a small circle of radius $r$, and calculate (easily) that $\int_{\gamma'}\frac1z\,dz=2\pi i$. 
As both integrals should be equal (because combining both you enclose a region where $1/z$ is analytic), you get 
$$
\int_0^{2\pi}\frac{(-a^2+b^2)\sin t\cos t+iab}{a^2\cos^2t+b^2\sin^2t}dt=2\pi i.
$$
This tells you that the real part on the left-hand-side is zero. Comparing the imaginary parts, you get 
$$
\int_0^{2\pi}\frac{ab}{a^2\cos^2t+b^2\sin^2t}dt=2\pi. 
$$
A: Here is a bit more "Complex Analysis" solution. Consider the simple graph:

Here we have our ellipse $\gamma$, small enough circle $\delta$, and two segments $I_1$ and $I_2$.
$\gamma$ is homotopically equivalent to the contour $I_1 \rightarrow \delta \rightarrow  I_2$.
Thus,
$$
\int_{\gamma} dz/z = \int_{I_1} dz/z + \int_{\delta} dz/z + \int_{I_2} dz/z
$$
Integrals over $I_1$ and $I_2$ cancels out. Now it remains to take the integral $dz/z$ over a circle $\delta$.
