Finding $\lim_{n \to \infty} \int_0^n \frac{dx}{1+n^2\cos^2x}$ Find $$\lim_{n \to \infty} \int_0^n \frac{dx}{1+n^2\cos^2x}$$
I tried: 


*

*mean value theorem.

*variable change with $ \tan x = t $ but I need to avoid the points which are not in the domain of $\tan$  and it's complicated.
 A: Result
Defining
$$f(n) = \int_0^n \frac{1}{1+n^2 \cos(x)^2} \,dx\tag{1}$$
we find
$$\lim_{n\to\infty}f(n)=1$$
Derivation
We split the integration region $(0,n)$ into the intervals $(0,\pi/2) ,( k \pi -\pi/2, k\pi +\pi/2)$ with $k = 1, 2, ...,k_{max}= n/\pi$.
Hence letting
$x=k \pi + \xi$ so that $\cos(x) = (-1)^k \cos(\xi)$ and $\cos(x)^2 = \cos(\xi)^2$
we obtain
$$f(n) =  \int_0^{\frac{\pi}{2}} \frac{1}{1+n^2 \cos(x)^2} \,dx + \\
\sum_{k=1}^{k_{max}}\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\frac{1}{1+n^2 \cos(\xi)^2}\,d\xi\tag{2}$$
Notice that the integrals (except possible for the last one) are independent of $k$. 
Now
$$\left(\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\frac{1}{1+n^2 \cos(\xi)^2}\,d\xi\right)/.(\tan(\xi)\to t) \\
= \left(\int_{-\infty}^{\infty}\frac{1}{1+n^2+t^2}\,dt\right)/.(\frac{t}{\sqrt{1+n^2}}\to s)\\
=\frac{1}{\sqrt{1+n^2}}\int_{-\infty}^{+\infty}\frac{1}{1+s^2}\,ds
=\pi  \sqrt{\frac{1}{n^2+1}}\tag{3}$$
Since $k_{max}=\frac{n}{\pi}$ we get
$$f(n) \simeq \pi  \sqrt{\frac{1}{n^2+1}} k_{max} = \pi  \sqrt{\frac{1}{n^2+1}}\frac{n}{\pi} $$
$$\lim_{n\to\infty}f(n) = \lim_{n\to\infty}n\sqrt{\frac{1}{n^2+1}}=1$$
Hence the limit is $1$.
Remark: Notice that the first integral in $(2)$ and possibly the last one which might not fit exactly into the equally spaced pattern both are $O\left(\frac{1}{n}\right)$ and hence vanish in the Limit
Discussion
With the same technique you can show that the limit of the similar integral
$$g(n) = \int_0^n \frac{1}{1+ n \cos(x)}\,dx\tag{4}$$
does not exist as $g(n)$ diverges logarithmically.
A: Using the substitution $u=\tan{(x)}\Rightarrow du=\sec^2{(x)}dx$ turns the integral into
$$\int_0^\infty \frac{du}{u^2+n^2+1}+\bigg\lfloor\frac{n-\frac\pi2}{\pi}\bigg\rfloor\int_{-\infty}^\infty \frac{du}{u^2+n^2+1}+\int_{-\infty}^{\tan{(n)}}\frac{du}{u^2+n^2+1}$$
$$=\bigg[\frac1{\sqrt{n^2+1}}\arctan{\bigg(\frac{u}{\sqrt{n^2+1}}\bigg)}\bigg]_0^\infty+\bigg\lfloor\frac{n-\frac\pi2}{\pi}\bigg\rfloor\bigg[\frac1{\sqrt{n^2+1}}\arctan{\bigg(\frac{u}{\sqrt{n^2+1}}\bigg)}\bigg]_{-\infty}^\infty+\bigg[\frac1{\sqrt{n^2+1}}\arctan{\bigg(\frac{u}{\sqrt{n^2+1}}\bigg)}\bigg]_{-\infty}^{\tan{(n)}}$$
$$=\frac\pi{\sqrt{n^2+1}}+\frac\pi{\sqrt{n^2+1}}\bigg\lfloor\frac{n-\frac\pi2}{\pi}\bigg\rfloor+\frac1{\sqrt{n^2+1}}\arctan{\bigg(\frac{\tan{(n)}}{\sqrt{n^2+1}}\bigg)}$$
$$=\frac\pi{\sqrt{n^2+1}}\bigg\lfloor\frac{n+\frac\pi2}{\pi}\bigg\rfloor+\frac1{\sqrt{n^2+1}}\arctan{\bigg(\frac{\tan{(n)}}{\sqrt{n^2+1}}\bigg)}$$
$$=\frac{\pi\big\lfloor\frac{n}{\pi}+\frac12\big\rfloor+\arctan{\big(\frac{\tan{(n)}}{\sqrt{n^2+1}}\big)}}{\sqrt{n^2+1}}$$
Taking the limit as $n\to\infty$ we have
$$\lim_{n\to\infty}\frac{\pi\big\lfloor\frac{n}{\pi}+\frac12\big\rfloor+\arctan{\big(\frac{\tan{(n)}}{\sqrt{n^2+1}}\big)}}{\sqrt{n^2+1}}=\lim_{n\to\infty}\frac{n+\arctan{\big(\frac{\tan{(n)}}{n}\big)}}{n}=\lim_{n\to\infty}\bigg(1+\frac{\arctan{\big(\frac{\tan{(n)}}{n}\big)}}{n}\bigg)=1$$
The final limit of $\frac{\arctan{\big(\frac{\tan{(n)}}{n}\big)}}{n}$ is equal to zero because $\frac{-\pi}2\lt \arctan{(x)} \lt \frac\pi2$ so $\frac{-\pi}{2n}\lt \frac{\arctan{\big(\frac{\tan{(n)}}{n}\big)}}{n} \lt \frac\pi{2n}$ and both bounds tend to zero in the limit.
