Relation between counting measure and Tonelli theorem 
This is from Rudin's RCA book. But I can't understand how he got Corollary. What he takes as $f_n, X$? If we consider counting measure how integral converts to sum? I can't show this after some attempts.
Can anyone give a detailed answer please? I would be grateful for answer.
 A: In this case, $X = \{1, 2, 3, \ldots\}$ and $f_j(i) = a_{i, j}$. If $\mu$ is counting measure and
$$
f(i)
= \sum_{j=1}^\infty f_j(i)
= \sum_{j=1}^\infty a_{i, j},
$$
then by Theorem 1.27 we have
$$
\sum_{i=1}^\infty \sum_{j=1}^\infty a_{i, j}
= \sum_{i=1}^\infty f(i)
= \int_X f \, d\mu
= \sum_{j=1}^\infty \int_X f_j \, d\mu
= \sum_{j=1}^\infty \sum_{i=1}^\infty a_{i, j}.
$$
Edit. A general fact about counting measure $\mu$ is the following: if $f : X \to [0, \infty]$ is measurable and $X$ is countable, then, interchanging summation and integration using Theorem 1.27 or the Monotone Convergence Theorem, we get
$$
\int_X f \, d\mu
= \int_X \left(\sum_{x \in X} f(x) \mathbf{1}_{\{x\}}\right) \, d\mu
= \sum_{x \in X} f(x) \int_X \mathbf{1}_{\{x\}} \, d\mu
= \sum_{x \in X} f(x) \mu(\{x\})
= \sum_{x \in X} f(x).
$$
A: Here $X=\mathbb N$
For $n=1,2,\dots$ let $f_{n}:\mathbb{N}\to\left[0,\infty\right]$
and let $\mu$ denote the counting measure on $\mathbb{N}$.
Define $f:=\sum_{n=1}^{\infty}f_{n}$, in the sense that $f:\mathbb{N}\to\left[0,\infty\right]$
is prescribed by $k\mapsto\sum_{n=1}^{\infty}f_{n}\left(k\right)$.
Then: $$\int fd\mu=\sum_{k=1}^{\infty}f\left(k\right)=\sum_{k=1}^{\infty}\sum_{n=1}^{\infty}f_{n}\left(k\right)$$
According to the theorem we have also: $$fd\mu=\sum_{n=1}^{\infty}\int f_{n}d\mu=\sum_{n=1}^{\infty}\sum_{k=1}^{\infty}f_{n}\left(k\right)$$
Final conclusion:$$\sum_{k=1}^{\infty}\sum_{n=1}^{\infty}f_{n}\left(k\right)=\sum_{n=1}^{\infty}\sum_{k=1}^{\infty}f_{n}\left(k\right)$$
A: If we are in $(\Omega, F, \mu_c)$ where $\mu_c$ is the counting measure, the measurable function are of the form $f= \{a_i \}_{i\in \mathbb N}$ and $\int_\Omega f d\mu_c = \sum_{i=1}^\infty a_i$
So that $f_j=\{a_{ij}\}_{i,j \in \mathbb N}$, thus using the Tonelli theorem in this setting, you get the thesis
A: Let $f(i)=\sum_{j=1}^\infty a_{ij}$, with $f(i)=0$ whenever $i$ is not a positive integer, and $\mu(\{i\})=1$ for $i=1,2,\cdots$, and 0 otherwise. Now apply Tonelli's theorem.
