How to solve Integrals when the substituted function is discontinuous at some points in the interval $[a,b]$ ? So I have the following integral: $$\int_{0}^{2\pi}{a\over\cos^2(x)-{\left(a\over b\right)^2}}dx$$ Now had this Integral been indefinite then I would have substituted, $\tan x=t$, but notice that this is not possible here as $\tan x$ is discontinuous at $x=\pi/2,3\pi/2\in[0,2\pi]$. How should I proceed in this case? Moreover, is there a standard technique to deal with problems of such kind? 

Hint. We assume $\dfrac{a}{b}>1.$ One may observe that, the change of variable $u=x-\pi$ and the parity of the integrand give
$$
I=\int_{0}^{2\pi}{a\over\cos^2(x)-{\left(a\over b\right)^2}}dx=\int_{-\pi}^{\pi}{a\over\cos^2(u)-{\left(a\over b\right)^2}}dx=2\int_0^{\pi}{a\over\cos^2(u)-{\left(a\over b\right)^2}}dx
$$ then by the change of variable $v=u-\dfrac\pi2$ one gets
$$
I=2\int_{-\pi/2}^{\pi/2}{a\over\sin^2(v)-{\left(a\over b\right)^2}}dv=4\int_0^{\pi/2}{a\over\sin^2(v)-{\left(a\over b\right)^2}}dv=4\int_0^{\pi/2}{a\over\cos^2(x)-{\left(a\over b\right)^2}}dx
$$ then one may used the desired change of variable $t=\tan x$.
