# Prove sum is commutative with measure theory result

Given a measured space $(X,\mathcal{A},\mu)$, consider the following function $f:X\rightarrow \mathbb{R}^+$ defined by

$$f(x)=\sum_{n=0}^\infty f_n(x),$$

where $f_n(x)$ are positive measurable functions in $X$.

It is proven that

$$\int_X f \;d\mu = \sum_{n=0}^\infty \int_X f_n \;d\mu.$$

I would like to use this result to prove that

$$\sum_{i=0}^\infty\sum_{j=0}^\infty a_{ij} = \sum_{j=0}^\infty\sum_{i=0}^\infty a_{ij},$$

where $a_{ij}\ge 0$.

For this I consider the measured space $(\mathbb{N},\mathcal{P}(\mathbb{N}),\mu)$ where $\mu$ is the counting measure, and the function $f$ defined on $\mathbb{N}$:

$$f(j)=\sum_{i=0}^\infty a_{ij}.$$

Using the previous result, and given that we are using the counting measure, I get:

$$\int_{\mathbb{N}} f \;d\mu = \sum_{i=0}^\infty \int_{\mathbb{N}} a_i \;d\mu = \sum_{i=0}^\infty \sum_{j=0}^\infty a_{ij}.$$

But we also have

$$\int_{\mathbb{N}} f \;d\mu = \sum_{i=0}^\infty \int_{\mathbb{N}} a_i \;d\mu = \int_{\mathbb{N}} \sum_{i=0}^\infty a_i \;d\mu = \sum_{j=0}^\infty \sum_{i=0}^\infty a_{ij},$$

hence the result.

Is this correct ? Thanks.

It looks ok, the only thing I would suggest (and this is just a proof-writing issue) is that in your last line of equalities, by definition $\int_\mathbb{N}f(j)d\mu(j)=\int_\mathbb{N}\sum_i a_{ij}d\mu(j)$, and it is actually the result you use in the previous line that allows you to write the integral inside the sum. Also since the last equality follows immediately from the definition, it might not be a bad idea to write it before the more "nontrivial" equality. Also it's not a bad idea to mention that these equalities hold in the "$=+\infty$" case in the sense that if one side equals infinity then the other side is infinite as well.