integral $\int_0^\pi \frac{\cos(2t)}{a^2\sin^2(t)+b^2\cos^2(t)}dt$ I want to compute this integral
$$\int_0^\pi \frac{\cos(2t)}{a^2\sin^2(t)+b^2\cos^2(t)}dt$$
where $0<b \leq a$.
I have this results
$$I_1=-\frac{ab}{2\pi}\int_0^\pi \frac{\cos(2t)}{a^2sin^2(t)+b^2cos^2(t)}dt=\frac{a}{a+b}-\frac{1}{2}$$
But I don't know how to prove this equality.
Which can help me,
Thanks for all.
 A: Hint First compute 
$$
I=\int_0^{2\pi} \frac{\cos(2t)}{a^2\sin^2(t)+b^2\cos^2(t)}dt=\int_0^{2\pi} \frac{\cos^2(t)-\sin^2(t)}{a^2\sin^2(t)+b^2\cos^2(t)}dt=\int_0^{2\pi}R(\cos(t), \sin(t)) dt
$$
Where $R$ is the rational function given by $$R(x,y)=\frac{x^2-y^2}{a^2y^2+b^2x^2}$$
How to do this? Put $z=e^{it}=\cos(t)+i\sin(t)$, thus 
$$
\cos(t)=Re(z)=\frac{z+z^{-1}}{2}, \ \\ \sin(t)=Im(z)=\frac{z-z^{-1}}{2i}, \\ dz=ie^{it} dt=iz \ dt \Longrightarrow dt=\frac{1}{iz}dz
$$
Then $I$ can be seen as a contour integral, solve it by using residues 
$$
I=\int_0^{2\pi}R(\cos(t), \sin(t)) dt= \int_{|z|=1} R\left(\frac{z+1/z}{2}, \frac{z-1/z}{2i} \right)\frac{1}{iz}dz
$$
Finally: Note that 
$$
\int_0^{\pi} \frac{\cos(2t)}{a^2\sin^2(t)+b^2\cos^2(t)}dt=\frac{I}{2}
$$
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&=\int_0^{\pi} \frac{\cos(2t)}{a^2\sin^2(t)+b^2\cos^2(t)}dt\\\\
&=\frac{1}{2}\int_0^{2\pi}\frac{\cos t}{\frac{b^2+a^2}{2}+\frac{b^2-a^2}{2}\cos t}dt\\\\
&=\frac{1}{(b^2-a^2)}\int_0^{2\pi}\frac{\cos t}{\frac{b^2+a^2}{b^2-a^2}+\cos t}dt\\\\
&=\frac{2\pi}{(b^2-a^2)}-\frac{b^2+a^2}{(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=\frac{2\pi}{(b^2-a^2)}-\frac{b^2+a^2}{(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$ becomes $$\begin{align}I&=\frac{2\pi}{(b^2-a^2)}-\frac{b^2+a^2}{(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{2\pi}{(b^2-a^2)}-\frac{b^2+a^2}{(b^2-a^2)^2}\left(2\pi i \frac{-2i}{-2\frac{2ab}{a^2-b^2}}\right)\\\\&=\frac{2\pi}{(b^2-a^2)}+\frac{2\pi}{ab}\frac{a^2+b^2}{2(a^2-b^2)}\\\\&=\frac{-2\pi}{ab}\left(\frac12 -\frac{a}{a+b}\right)\end{align}$$


NOTE:
For $I_2=\int_0^{\pi} \frac{\sin(2t)}{a^2\sin^2(t)+b^2\cos^2(t)}dt$, 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$!
A: Although there is already an accepted answer, I put this answer here, since someone might have use of the "tool" to work with the expression like this before integrating.
The case $a=b$ is trivial, so we assume $a>b$. We write the numerator $\cos 2t$ in the following way:
$$
\cos 2t=\cos^2t-\sin^2t=\alpha\bigl(b^2\cos^2t+a^2\sin^2t\bigr)+(1-\alpha b^2)\cos^2t-(1+\alpha a^2)\sin^2t,
$$
and we'll soon see how to choose $\alpha$ in a good way, where good means that we should get something that we can integrate. Let us first use the trig-one on the $\cos^2 t$ part, to get
$$
\cos 2t = \alpha\bigl(b^2\cos^2t+a^2\sin^2t\bigr)+(1-\alpha b^2)-\bigl[(1-\alpha b^2)+(1+\alpha a^2)\bigr]\sin^2 t.
$$
Now, we choose $\alpha$ so that the constant in brackets is zero, i.e.
$$
(1-\alpha b^2)+(1+\alpha a^2)=0 \iff \alpha=\frac{2}{b^2-a^2}.
$$
This gives
$$
\cos 2t = \frac{2}{b^2-a^2}(b^2\cos^2t+a^2\sin^2t)-\frac{a^2+b^2}{b^2-a^2}.
$$
Now comes the fun part. We can write the integrand
$$
\begin{aligned}
\frac{\cos 2t}{b^2\cos^2t+a^2\sin^2t}&=\frac{2}{b^2-a^2}-\frac{a^2+b^2}{b^2-a^2}\frac{1}{b^2\cos^2t+a^2\sin^2t}\\
&=\frac{2}{b^2-a^2}-\frac{a^2+b^2}{b^2-a^2}\frac{1}{b^2\cot^2t+a^2}\frac{1}{\sin^2t}.
\end{aligned}
$$
This is easy to integrate,
$$
\int \frac{\cos 2t}{b^2\cos^2t+a^2\sin^2t}\,dt = \frac{2t}{b^2-a^2}-\frac{a^2+b^2}{b^2-a^2} \frac{1}{ab}\text{arccot}\,\Bigl(\frac{b\cot t}{a}\Bigr).
$$
I'm sure you can insert the limits and get the result from this. I get
$$
\int_0^\pi \frac{\cos 2t}{b^2\cos^2t+a^2\sin^2t}\,dt=\frac{(a-b)\pi}{ab(a+b)}.
$$
