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?

Are you talking about this?:

$$\small\int\frac{dx}{a^2\cos^2x +b^2 \sin^2x}=\int\frac{\sec^2xdx}{a^2+b^2 \tan^2x}\stackrel{u=\tan x}=\frac1{b^2}\int\frac{du}{a^2/b^2+u^2}=\frac1{b^2}\frac1{a/b}\arctan\frac{\tan x}{a/b}$$
  So:
  $$\int_0^{\pi}\frac{dx}{a^2\cos^2x +b^2 \sin^2x}=\frac1{ab}\arctan\frac{b\tan x}a\Bigg|_0^{\pi}=0$$

This is wrong because at $\pi/2$, $\cos x=0\iff \sec x\to\infty$!! Or you can say because $\tan x$(=u) misbehaves at $x=\pi/2$.It should rather be done like:

$$\int_0^{\pi}\frac{dx}{a^2\cos^2x +b^2 \sin^2x}=\frac1{ab}\arctan\frac{b\tan x}a\Bigg|_0^{\displaystyle\pi/2^-}+\frac1{ab}\arctan\frac{b\tan x}a\Bigg|_{\displaystyle\pi/2^+}^{\displaystyle\pi}$$

