integration of definite integral involving sinx and cos x Evaluate $\int_0^{\pi}\frac{dx}{a^2\cos^2x +b^2 \sin^2x}$
I got numerator $\sec^2 x$ and denominator $b^2 ( a^2/b^2 + \tan^2x)$.
I made substitution $u= \tan x$. That way $\sec^2 x$ got cancelled and the answer was of form $1/ab$ ($\tan^{-1} (bu/a)$)
And then if I put limits answer is $0$ but answer is wrong. Where did I go wrong?

Hint:
The problem is that you divide the numerator and the denominator of the integrand by $\cos^2 x$, but this can be done only for $\cos^2 x \ne 0$ i.e. $x\ne \pi/2$. So you have to divide your integral in two improper integrals as:
$$
\int_0^\pi = \int_0^{(\pi/2)^-}-\int_\pi^{(\pi/2)^+}
$$
Your substutition is correct, so you have the limit:
$$
\lim_{x \rightarrow (\pi/2)^{\pm}} \arctan \left(\frac{b}{a} \tan x \right)
$$
that is $\pm \pi/2$.
