Real and Complex Analysis Rudin thm 1.41 I'm having trouble understanding the implication Rudin makes here at the last two sentences. 
How do the integrals look like (1):
I was thinking they are like this:
$$ \int_X g d\mu = \sum_{k=1} ^{\infty} \int_X \chi_{E_{k}} d \mu $$
I'm having trouble how this is (1)...
 A: Thus lemma is also known as the Borel–Cantelli lemma. So we want to show that $\mu(A) = 0$. First notice that by definition $x \in A$ if and only if $x \in E_k$ for infinitely many $k$. Let $x \in A$. Then as $g(x) = \sum_{k=1}^{\infty} \chi_{E_k}(x)$, we see $g(x) = \infty$ (since $x$ is in infinitely many $E_k$). Now the idea is to recall that if $\int |g(x)| < \infty$, then $g(x)$ is finite valued almost everywhere.  We omit the absolute values since $g \geq 0$
So we want to integrate $g$ and use the monotone convergence theorem(our $g$ and soon to be defined $g_n$ are non-negative and measurable, so we can apply MCT) with $g_n(x) := \sum_{k=1}^{n} g(x)$, to interswap the order of integration and summation.
So we see $\int_{\mathbb{R}^d} g(x)$ = $\int_{\mathbb{R^d}} \sum_{k=1}^{\infty} \chi_{E_k}(x)$ = $\sum_{k=1}^{\infty} \int _{\mathbb{R}^d}\chi_{E_k}(x)$ = $\sum_{k=1}^{\infty} \int_{E_k} 1$ = $\sum_{k=1}^{\infty} \mu(E_k) < \infty$ by assumption. Hence, we have $g(x)$ is finite valued almost everywhere. Therefore, as $A$ is the set where $g(x)$ is infinity, we see $\mu(A) = 0$ as desired.
A: There are two major facts employed here. The first is that we can interchange the series sign with integral sign by a suitable application of the monontone convergence theorem. The second is that $\int_{A} g = \int g1_{A}$ for all measurable $A$. 
