Legality of using substitution $u=nx$ in an integral Consider the following integral
$$\lim_{n\rightarrow \infty} \int_0^\infty n^3\ln(1+x^2)e^{-nx} dx$$
and the substitution $u=nx$.
We get the integral
$$\lim_{n\rightarrow \infty} \int_0^\infty n^2\ln\left(1+\frac{u^2}{n^2}\right)e^{-u}du$$
We can use the Dominated Convergence Theorem to pass the limit through the integral and we get that the integral is equal to
$$ \int_0^\infty u^2e^{-u}du$$
This integral can be integrated by parts and shown to be equal to 2.
What is the legality and rigor of this substitution? In particular, it seems that we have smuggled a $n$ into a variable substitution and swept it under the rug when we took the limit and evaluated the integral. Am I missing something? Does this have something to do with a change of coordinates?
Lastly, are there conditions in which we can and cannot do this substitution?
 A: The integrand $\ln(1+x^{2})e^{-nx}$ is nonnegative and continuous on $[0,\infty)$, so the first integral is in fact an improper Riemann integral and can be written as
\begin{align*}
\int_{0}^{\infty}\ln(1+x^{2})e^{-nx}dx=\lim_{M\rightarrow\infty}\int_{0}^{M}\ln(1+x^{2})e^{-nx}dx.
\end{align*}
Now the usual substitution works for the interval $[0,M]$ to get
\begin{align*}
\int_{0}^{M}\ln(1+x^{2})e^{-nx}=n^{-1}\int_{0}^{nM}\ln(1+(u/n)^{2})e^{-u}du.
\end{align*}
The point is that, 
\begin{align*}
\lim_{M\rightarrow\infty}\int_{0}^{nM}\ln(1+(u/n)^{2})e^{-u}du=\lim_{L\rightarrow\infty}\int_{0}^{L}\ln(1+(u/n)^{2})e^{-u}du,
\end{align*}
this can be seen by the usual $\epsilon$-argument, keep in mind that $n>0$ is fixed.
To be more specific, let 
\begin{align*}
F(x)=\int_{0}^{x}\ln(1+(u/n)^{2})e^{-u}du,
\end{align*}
and $g(M)=F(nM)$, let the left-sided limit as $L_{1}$ and the right-sided one as $L_{2}$.
Given $\epsilon>0$, there is a $\delta_{1}>0$ such that 
\begin{align*}
|g(M)-L_{1}|<\epsilon,~~~~M\geq\delta_{1}.
\end{align*}
For all $L\geq n\delta_{1}$, let $L=nM$, then $M\geq\delta_{1}$, and hence
\begin{align*}
|F(L)-L_{1}|=|F(nM)-L_{1}|=|g(M)-L_{1}|<\epsilon,
\end{align*}
this shows that $\lim_{L\rightarrow\infty}F(L)=L_{1}$. By the uniqueness of limit, we must have $L_{1}=L_{2}$.
A: Not an answer but too long for a comment.
The problem is interesting because everything can be rigorously computed.
Using one integration by parts
$$\int \ln(1+x^2)\,e^{-nx}\,dx=-\frac{e^{-n x} \log \left(x^2+1\right)}{n}+\frac 2n\int\frac{ x \,e^{-n x}}{ 1+x^2}\,dx$$ which makes
$$\int_0^\infty \ln(1+x^2)\,e^{-nx}\,dx= \frac 2n\int_0^\infty\frac{ x \,e^{-n x}}{ 1+x^2}\,dx$$
Now, using partial fraction decomposition
$$\frac x{1+x^2}=\frac{1}{2 (x+i)}+\frac{1}{2 (x-i)}$$ and simple changes of variable $x=t\pm i$ lead to
$$\int\frac{ x \,e^{-n x}}{ 1+x^2}\,dx=\frac{1}{2} e^{-i n} \text{Ei}(-n (x-i))+\frac{1}{2} e^{i n} \text{Ei}(-n (x+i))$$
$$\int_0^\infty\frac{ x \,e^{-n x}}{ 1+x^2}\,dx=\frac{1}{2} (\pi -2 \text{Si}(n)) \sin (n)-\text{Ci}(n) \cos (n)$$
$$\int_0^\infty n^3\ln(1+x^2)\,e^{-nx} dx=n^2 ((\pi -2 \text{Si}(n)) \sin (n)-2 \text{Ci}(n) \cos (n))$$ Using the asymptotics of the sine and cosine integrals and simplifying 
$$\int_0^\infty n^3\ln(1+x^2)\,e^{-nx} dx=2-\frac{12}{n^2}+\frac{240}{n^4}-\frac{10080}{n^6}+O\left(\frac{1}{n^8}\right)$$ which shows the limit and how it is approached.
Morover, this gives a very good approcimation of the integral of concern.
$$\left(
\begin{array}{ccc}
n & \text{approximation} & \text{exact} \\
 10 & 1.8939200 & 1.8977078 \\
 15 & 1.9505225 & 1.9507198 \\
 20 & 1.9713425 & 1.9713651 \\
 25 & 1.9813731 & 1.9813772 \\
 30 & 1.9869491 & 1.9869501
\end{array}
\right)$$
