How can I prove the following equality I have the following equality :
$$I_1=-\frac{ab}{2\pi}\int_0^\pi \frac{\cos(2t)}{a^2\sin^2(t)+b^2\cos^2(t)}dt=\frac{a}{a+b}-\frac{1}{2}$$
$$I_2=-\frac{ab}{2\pi}\int_0^\pi \frac{\sin(2t)}{a^2\sin^2(t)+b^2\cos^2(t)}dt=0$$
where $0 <b \leq a$.
I used the residues but I could not prove this equality
 A: One trick to facilitate analysis is to write
$$\sin^2x=\frac{1-\cos 2x}{2}$$
and
$$\cos^2x=\frac{1+\cos 2x}{2}$$
Thus, 
$$a^2\sin^2(t)+b^2\cos^2(t)=\frac{b^2+a^2}{2}+\frac{b^2-a^2}{2}\cos 2t$$
For the integral of interest, we can write
$$\begin{align}
I_1&=-\frac{ab}{2\pi}\int_0^{\pi} \frac{\cos(2t)}{a^2\sin^2(t)+b^2\cos^2(t)}dt\\\\
&=-\frac{ab}{4\pi}\int_0^{2\pi}\frac{\cos t}{\frac{b^2+a^2}{2}+\frac{b^2-a^2}{2}\cos t}dt\\\\
&=-\frac{ab}{2\pi(b^2-a^2)}\int_0^{2\pi}\frac{\cos t}{\frac{b^2+a^2}{b^2-a^2}+\cos t}dt\\\\
&=-\frac{ab}{(b^2-a^2)}+\frac{ab(b^2+a^2)}{2\pi(b^2-a^2)^2}\int_0^{2\pi}\frac{1}{\frac{b^2+a^2}{b^2-a^2}+\cos t}dt
\end{align}$$
Can you finish now?
SPOLIER ALERT
SCROLL OVER SHADED AREA TO SEE ANSWER

Starting with the last term $I_1=-\frac{ab}{(b^2-a^2)}+\frac{ab(b^2+a^2)}{2\pi(b^2-a^2)^2}\int_0^{2\pi}\frac{1}{\frac{b^2+a^2}{b^2-a^2}+\cos t}dt$, we move to the complex plane by letting $z=e^{it}$.  Then, $I_1$ becomes $$\begin{align}I_1&=-\frac{ab}{(b^2-a^2)}+\frac{ab(b^2+a^2)}{2\pi(b^2-a^2)^2}\oint_C \frac{-2i}{z^2+2\frac{b^2+a^2}{b^2-a^2}\,z+1}dz\\\\&=-\frac{ab}{(b^2-a^2)}+\frac{ab(b^2+a^2)}{2\pi(b^2-a^2)^2}\left(2\pi i \frac{-2i}{-2\frac{2ab}{a^2-b^2}}\right)\\\\&=-\frac{ab}{(b^2-a^2)}-\frac{a^2+b^2}{2(a^2-b^2)}\\\\&=\frac12 -\frac{a}{a+b}\end{align}$$which differs from the posted answer by a factor of $-1$.  For $a=2$ and $b=1$, Wolfram Alpha confirms the value of the integral as $-1/6$ agreeing with the answer herein, whereas the posted answer is $+1/6$.


For $I_2$, enforce the substitution $t= \pi -x$.  Then, we see 
$$\begin{align}
I_2&=\int_0^{\pi} \frac{\sin(2t)}{a^2\sin^2(t)+b^2\cos^2(t)}dt\\\\
&=\int_{\pi}^{0} \frac{\sin 2(\pi-x)}{a^2\sin^2(\pi-x)+b^2\cos^2(\pi-x)}(-1)dx\\\\
&=\int_{0}^{\pi} \frac{-\sin (2x)}{a^2\sin^2(x)+b^2\cos^2(x)}dx\\\\
&=-I_2
\end{align}$$
Thus, we have $I_2=-I_2$ which, of course, implies $I_2=0$ as expected!
A: Let $$I=I_1+iI_2.$$
Then
\begin{eqnarray}
I&=&-\frac{ab}{2\pi}\int_0^\pi \frac{e^{2it}}{a^2\sin^2(t)+b^2\cos^2(t)}dt\\
&=&-\frac{ab}{4\pi}\int_0^{2\pi} \frac{e^{it}}{a^2\frac{1-\cos t}{2}+b^2\frac{1+\cos t}{2}}dt\\
&=&-\frac{ab}{2\pi}\int_0^{2\pi} \frac{e^{it}}{(a^2+b^2)+(b^2-a^2)\cos t}dt\\
&=&-\frac{ab}{2\pi i}\int_{|z|=1} \frac{1}{(a^2+b^2)+(b^2-a^2)\frac12(z+\frac{1}{z})}dz\\
&=&-\frac{ab}{\pi i}\int_{|z|=1} \frac{z}{2(a^2+b^2)z+(b^2-a^2)(z^2+1)}dz\\
&=&-\frac{ab}{\pi i}(2\pi i)\text{Res}\left(\frac{z}{2(a^2+b^2)z+(b^2-a^2)(z^2+1)},\frac{a-b}{a+b}\right)\\
&=&-\frac{ab}{\pi i}2\pi i\frac{a-b}{4ab(a+b)}\\
&=&\frac{b-a}{2(a+b)}\end{eqnarray}
and hence
$$ I_1=\frac{b-a}{2(a+b)}, I_2=0. $$
A: For $I_2$, one way is to use
$$\frac{d}{dt}\left(a^2\sin^2(t)+b^2\cos^2(t)\right)=2a^2\sin t\cos t-2b^2\cos t\sin t=(a^2-b^2)\sin(2t).$$
