Evaluate $\int_{-\infty}^{\infty} \frac{ne^{\cos x}}{1+n^2x^2}\ dx$ The main problem is to evaluate $$\lim_{n\to\infty} \int_{-\infty}^{\infty} \frac{ne^{\cos x}}{1+n^2x^2}\ dx$$
The hint of this problem suggests to observe the graph of $y = \frac{n}{1+n^2x^2}$ as n increasing and evaluating its intrgral on $(-\infty, \infty)$, and then find out the above limit.
The following is my thoughts (may not be correct).
Denote $f_{n}(x) = \frac{n}{1+n^2x^2}$. Then
$$\lim_{n\to\infty} f_{n}(x) = 
                    \begin{cases} 
                      0& \text{if $x$} \neq 0 \\ 
                      \lim_{n\to\infty} n & \text{if $x$} = 0
                    \end{cases}$$
Define
$$f(x) = 
                    \begin{cases} 
                      0& \text{if $x$} \neq 0 \\ 
                      \lim_{n\to\infty} n & \text{if $x$} = 0
                    \end{cases}$$
Then $\lim_{n\to\infty} f_{n}(x) = f(x)$, for all real number $x$.
Similarly, denote $g_{n}(x) = \frac{ne^{\cos x}}{1+n^2x^2}$. Then
$$\lim_{n\to\infty} g_{n}(x) = 
                    \begin{cases} 
                      0& \text{if $x$} \neq 0 \\ 
                      \lim_{n\to\infty} ne = e \lim_{n\to\infty} n & \text{if $x$} = 0
                    \end{cases}$$
Define
$$g(x) = 
                    \begin{cases} 
                      0& \text{if $x$} \neq 0 \\ 
                      e\lim_{n\to\infty} n & \text{if $x$} = 0
                    \end{cases}$$
Then $\lim_{n\to\infty} g_{n}(x) = g(x)$, for all real number $x$. And $g(x) = ef(x)$.
A little bit calculations give
$$\int_{-\infty}^{\infty} f_{n}(x) \ dx = \int_{-\infty}^{\infty} \frac{n}{1+n^2x^2}\ dx = arctan(nx) \bigg|_{x=-\infty}^{x=\infty} = \frac{\pi}{2} - \frac{-\pi}{2} = \pi$$
Then,
$$\pi = \lim_{n\to\infty} \pi = \lim_{n\to\infty}\int_{-\infty}^{\infty} f_{n}(x) \ dx \stackrel{correct ?}{=} \int_{-\infty}^{\infty} \lim_{n\to\infty}f_{n}(x) \ dx= \int_{-\infty}^{\infty} f(x) \ dx$$
Similarly,
$$\lim_{n\to\infty} \int_{-\infty}^{\infty} \frac{ne^{\cos x}}{1+n^2x^2}\ dx = \lim_{n\to\infty}\int_{-\infty}^{\infty} g_{n}(x) \ dx \stackrel{correct ?}{=} \int_{-\infty}^{\infty} \lim_{n\to\infty}g_{n}(x) \ dx \\ = \int_{-\infty}^{\infty} g(x) \ dx = \int_{-\infty}^{\infty} ef(x) \ dx = e\int_{-\infty}^{\infty} f(x) \ dx = e\pi$$
In the above work, I have two questions. First, does commuting limit and improper integral here be correct? Is there any theory to support the idea? Second, we have the improper integral for the impulse function like $f(x)$ and $g(x)$ in the above, this is beyond my knowledge in Calculus. Can we define the improper integral of $f(x)$ and $g(x)$ over $(-\infty, \infty)$?
And of-course, I am hoping and seeking for a more simple method, like we don't need to exchange the limit and the improper integral sign or avoiding to deal with improper integral of an impulse function.
 A: $$\int_{-\infty}^{+\infty}\frac{ne^{\cos x}}{1+n^2x^2}\,\mathrm dx=\int_{-\infty}^{+\infty}\frac{e^{\cos(y/n)}}{1+y^2}\,\mathrm dy.$$
Since $0\le\frac{e^{\cos(y/n)}}{1+y^2}\le h(y):=\frac e{1+y^2}$ and $h\in L^1(\Bbb R),$ the dominated convergence theorem gives:
$$\lim_{n\to\infty}\int_{-\infty}^{+\infty}\frac{e^{\cos(y/n)}}{1+y^2}\,\mathrm dy=
\int_{-\infty}^{+\infty}\lim_{n\to\infty}\frac{e^{\cos(y/n)}}{1+y^2}\,\mathrm dy=\int_{-\infty}^{+\infty}\frac e{1+y^2}\,\mathrm dy=e\pi.
$$
A: This gets the correct answer, but is quite unrigorous. Your argument can probably be formalised with distributions, but I wouldn't know. The essential idea behind it is correct, though.  The idea is that $x\mapsto\frac{1}{\pi}\frac{n}{1+n^2x^2}$ is a sequence of nascent Dirac delta functions (is nascent right? I'm sure I heard someone use an official term for this, but I forget) that, in the limit, 'act like $\delta$' to pick out the value $f(0)$ when $f$ is continuous. Note my below proof uses no properties of $x\mapsto\exp(\cos(x))$ other than its continuity and boundedness (and that the integrand is always positive, but this isn't necessary).
You can quite cleanly evaluate this limit using measure theory, but sometimes it's nice to indulge in old-school analysis. I hope it is instructive.

It is true that: $$\lim_{n\to\infty}\frac{n\cdot\exp(\cos(x))}{1+n^2x^2}=\begin{cases}0&x\neq0\\\infty&x=0\end{cases}$$
But it is false that $\lim_n\int g_n=\int\lim_n g_n$ here since $\int\lim_n g_n=0$, as $\lim_ng_n$ is zero almost everywhere (that it is infinity at $x=0$ is not relevant as $\{0\}$ is a negligible set in the sense of measure theory), and $\lim_n\int g_n$ is not zero.
You need to more accurately assess the rate of convergence to zero or to infinity, here. Define $h_n:x\mapsto\frac{n}{1+n^2x^2}(e-\exp(\cos(x)))$.
We have, for all nonzero $x$: $$0<\frac{n}{1+n^2x^2}<\frac{1}{n}x^{-2}$$Let $1>\delta>0$. This gives: $$0<\int_{|x|>n^{\delta-1}}h_n<2(e-e^{-1})n^{-\delta}$$
Let $\epsilon>0$. There is an $N\in\Bbb N$ that $n>N$ implies $0\le e-\exp(\cos(x))<\epsilon$ on $[-n^{\delta-1},n^{\delta-1}])$, since $n^{\delta-1}\to0$. For such $n$: $$\begin{align}0&<\int_{|x|\le n^{\delta-1}}h_n\\&<2\epsilon\arctan(n^{\delta})\end{align}$$
We see that, if $0<\delta<1$ is fixed, these estimates overall give: $$\begin{align}0&\le\liminf_{n\to\infty}\int_\Bbb Rh_n\\&\\&\le\limsup_{n\to\infty}\int_\Bbb Rh_n\\&\le\lim_{n\to\infty}\left\{2(e-e^{-1})n^{-\delta}+2\epsilon\arctan(n^\delta)\right\}\\&=\pi\epsilon\end{align}
$$
Since $\epsilon>0$ was arbitrary, that squeezes: $$\lim_{n\to\infty}\left[\pi e-\left(\int_{\Bbb R}g_n\right)\right]=0$$
Which was to be shown.
