Integrate $\int_0^{\pi/2}\frac{\cos^2x}{a\cos^2x + b\sin^2x}\,dx$ I don't know how to deal with this integral
$$I=\displaystyle\int_0^{\pi/2}\frac{\cos^2x}{a\cos^2x + b\sin^2x}\,dx$$
I reached the step
$$I
=\displaystyle\ \int_0^{\pi/2}\frac{1}{a + b\tan^2x}dx$$
Now what should I do? Please help.
 A: Now substitute
$\displaystyle\ u=\tan x \implies x= tan^{-1} u \implies dx=\frac{1}{1+u^2} du$
$\displaystyle\ =\int_0^{\infty}\frac{1}{(1+u^2)(a + bu^2)}du$
Partial Fractions
$\displaystyle\ =\int_0^{\infty}\frac{1}{(1+u^2)(a + bu^2)}du= \frac{1}{a-b} \left(\int_{0}^{\infty} \frac{du}{1+u^{2}} - b \int_{0}^{\infty} \frac{du}{a+bu^{2}} \right)$
Evaluating
$\displaystyle\ =\frac{1}{a-b} \left(\int_{0}^{\infty} \frac{du}{1+u^{2}} - b \int_{0}^{\infty} \frac{du}{a+bu^{2}} \right)$
$\displaystyle\ =\frac{1}{a-b} \left([\tan x]_0^{\infty} - b \left(\frac{\tan^{-1}\left[\frac{\sqrt{b}x}{\sqrt{a}}\right)}{\sqrt{ab}} \right]_0^{\infty}\right)$
Put the Values
A: put $\displaystyle I = \int^{\frac{\pi}{2}}\frac{\cos^2 x}{a\cos^2 x+b\sin^2 x}dx$ and $\displaystyle J = \int^{\frac{\pi}{2}}_{0}\frac{\sin^2 x}{a\cos^2 x+b\sin^2 x}dx$
$\displaystyle aI+bJ = \frac{\pi}{2}$ 
A: Continue with
\begin{align}
\int_0^{\pi/2}\frac{1}{a + b\tan^2x}dx
= &\ \frac1{a-b}\int_0^{\pi/2}\bigg(1-  \frac{b\sec^2x}{a + b\tan^2x}\bigg)dx\\
=& \ \frac1{a-b}\bigg( \frac\pi2- \frac\pi2 \sqrt{\frac ba}\bigg)
=\frac\pi{2(a+\sqrt{ab})}
\end{align}
