TITLE: What's wrong with this proof that $0 = 1$?
QUESTION [7 upvotes]: Let $$f_n(x)=\frac{1}{\sqrt{\pi n}}e^{-x^2/n}.$$ Note that $f_n(x)\to 0$ uniformly as $n\to\infty$. [Proof: $0\leq f_n(x)\leq\frac{1}{\sqrt{\pi n}}$; given any $\epsilon > 0$, let $M=\left\lceil\frac{1}{\pi\epsilon^2}\right\rceil$. This guarantees that $\forall n>M:\forall x:|f_n(x)-0|<\epsilon$.]
Uniform convergence justifies taking the limit $n\to\infty$ under the integral sign:
$$\lim_{n\to\infty}\int_{-\infty}^{+\infty} f_n(x)\,dx = 
\int_{-\infty}^{+\infty} \lim_{n\to\infty} f_n(x)\,dx$$
The left-hand side is $1$, because
$$\forall n>0:\int_{-\infty}^{+\infty} f_n(x)\,dx = 1,$$
whereas the right-hand side is $0$, because
$$\forall x\in\mathbb{R}:\lim_{n\to\infty} f_n(x) = 0.$$
Therefore,
$$1=0.$$

REPLY [4 votes]: Uniform convergence does not justify the interchange for an integral over an infinite interval. As an example, take $f_n(x) =1/n$ for $0\leqslant x\leqslant n$ and $f_n(x) =0$ for $x>n$.
If the improper integral is also uniformly convergent then it is permissible.