1. ## An exercise about interchange of limit.

The above image is Ex.12 in Rudin's "Principles of Mathematical Analysis", P167. I don't know how to prove it, can you help me? Thanks!

2. I found a proof here. For possible future reference, I copy it here along with several key words: improper integral, uniform convergence, compact, Rudin, P167, 12.
Note that the domain here is $(0,\infty)$, so $(0,u_0]$ is not a compact subspace, so we have to split the domain into two parts: (0,1] and $[1,+\infty)$. We first focus on the latter.
Since $\int_1^u|f_n|dx\leq\int_1^u gdx\leq\int_1^{+\infty}gdx$ which is a fixed number independent of $u$, $f_n$ is improper Riemann integrable on $[1,\infty)$ for all $n$. Since $\lim_{n \to \infty } {f_n}(x) = f(x)$ for all $x\in[1,\infty), \lim_{n \to \infty } |f_n(x)| = |f(x)|$, so $|f(x)|\leq g(x)$ for all $x$, so $\int_1^{+\infty}fdx$ exists too.
Now we want to prove $h_n(u)=\int_1^u f_n dx$ converges uniformly to $h(u)=\int_1^u fdx$ on $[1,+\infty)$. From the hypothesis We know that $f_n$ converges in the topology of compact convergence, which is unfortunately coarser than uniform topolgy, so we cannot deduce from general topology the desired conclusion and have to prove it from scratch: Given any $\epsilon>0$, since $\int_1^{+\infty}gdx<\infty$, there is a $u_0>1$ such that $\int_{u_0}^{+\infty}gdx<\epsilon/4$ by Cauchy criterion. Because $[1,u_0]$ is now compact, we can choose an $N$ such that $|f_n(x)-f(x)|<\frac{\epsilon}{2(u_0 - 1)}$ for all $x\in[1,u_0]$ and $n\geq N$. We show this $N$ will do the job. For any $u\in[1,+\infty)$ and $n\geq N$ we can write $|h_n(u)-h(u)|=|\int_1^u[f_n(x)-f(x)]dx|\leq|\int_1^{\min(u_0,u)}(f_n-f)dx|$ $+\chi_{\{u_0, where $\chi_{\{u_0. Since $\min(u_0,u)\leq u_0$, the first term $\leq \frac{\epsilon}{2(u_0 - 1)}(\min(u_0,u)-1)\leq\epsilon/2$. The second term exists only if $u_0, in which case, in view of $0\leq |f|,|f_n|\leq g$ for all $x\in[1,+\infty)$, $|\int_{u_0}^u(f_n-f)dx|\leq\int_{u_0}^u(|f_n|+|f|)dx\leq2\int_{u_0}^ ugdx\leq2\int_{u_0}^{+\infty}gdx<\epsilon/2$. Then we get $|\int_1^u(f_n-f)dx|<\epsilon$ for all $u\in[1,+\infty)$ whenever $n\geq N$ which is independent of $u$. Therefore for any $n\geq$this $N$, $|\int_1^{+\infty}f_n dx-\int_1^{+\infty}fdx|=|\lim_{u \to +\infty}\int_1^u(f_n-f)dx|=\lim_{u \to +\infty}|\int_1^u(f_n-f)dx|\leq\lim_{u \to +\infty}\epsilon$ $=\epsilon$, as desired.
Now we have proved $\lim_{n\to\infty}\int_1^{+\infty}f_n dx=\int_1^{+\infty}fdx$, applying the same argument above shows $\lim_{n\to\infty}\int_0^1f_ndx=\int_0^1fdx$. Summing up these two equalities and noting that all improper integrals involved are valid, we have $\lim_{n\to\infty}\int_0^{+\infty}f_n dx=\lim_{n\to\infty}\int_0^1 f_n dx+\lim_{n\to\infty}\int_1^{+\infty}f_n dx=\int_0^1 f dx+\int_1^{+\infty}f dx=\int_0^{+\infty}f dx$, i.e., $\lim_{n\to\infty}\lim_{\substack{u_1\to +\infty\\u_2\to 0^+}}\int_{u_2}^{u_1}f_n dx=\lim_{\substack{u_1\to +\infty\\u_2\to 0^+}}\lim_{n\to\infty}\int_{u_2}^{u_1}f_n dx$, which completes the whole proof.
The same idea applies if we want to prove convergence of an uncountable sequence of improper integrals, which is used at the end of the proof of Stirling's formula in page 195 of this book.
Thank Pere Callahan for this brilliant proof, also thank myself for the hard search.

3. How do we know $\int_{1}^{u} g(x)dx \leq \int_{1}^{\infty} g(x)dx$?

4. First, if function $f$ and $g$ are defined on $[1,+\infty)$, $f(x)\leq g(x)$ for all $x\in [1,+\infty)$, and both $\lim_{x\to+\infty}f(x)$ and $\lim_{x\to+\infty}g(x)$ exists, then it can be proved that $\lim_{x\to+\infty}f(x)\leq\lim_{x\to+\infty}g(x)$, by Th 4.2 and Th 3.19, as well as Examples 3.18 of this book.
As for your question, we know that $\int_{1}^{+\infty} g(x)dx=\lim_{v\to+\infty}\int_1^v g(x)dx$. Since $v$ is approching infinity, we may assume it is sufficiently large so that $v>u$, so the right side of the above eqution $=\lim_{v\to+\infty}[\int_1^u g(x)dx+\int_u^v g(x)dx]$ (Th6.12(c)). $\int_1^u g(x)dx$ is a constant relative to $v$, so $\lim_{v\to+\infty}\int_1^u g(x)dx=\int_1^u g(x)dx$, as a result the second limit exists and the above limit= $\int_1^u g(x)dx+\lim_{v\to+\infty}\int_u^v g(x)dx$ (Th3.3(a)). By hypothesis, $g(x)\geq|f_n(x)|\geq 0$ for any $x\in[u,v]$, so $\int_u^v g(x)dx\geq 0$ according to Th 6.12(b). Then by the conclusion of the first paragraph, $\lim_{v\to+\infty}\int_u^v g(x)dx\geq\lim_{v\to+\infty}0=0$, which implies $\int_{1}^{+\infty} g(x)dx\geq\int_1^u g(x)dx$.