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?

$$\begin{eqnarray*}\color{red}{I}&=&\int_{0}^{\pi}\frac{dx}{a^2\cos^2 x+b^2\sin^2 x}=2\int_{0}^{\pi/2}\frac{dx}{a^2\cos^2 x+b^2\sin^2 x}\\&=&2\int_{0}^{+\infty}\frac{dt}{(1+t^2)\left(a^2\frac{1}{1+t^2}+b^2\frac{t^2}{t^2+1}\right)}=2\int_{0}^{+\infty}\frac{dt}{a^2+b^2 t^2}\\&=&\frac{2}{ab}\int_{0}^{+\infty}\frac{du}{1+u^2}=\color{red}{\frac{\pi}{ab}}.\end{eqnarray*}$$
Here we replaced $x$ with $\arctan t$, then $t$ with $\frac{a}{b}\,u$.
