Let $(X,\mu)$ be a measure space. The following two theorems hold:
- Let $\{f_n\}$ be a sequence of measurable functions $f_n:(X,\mu) \to [0,\infty]$. Then we have $$\int_X \left(\sum_{n=1}^\infty f_n\right) \ d \mu = \sum_{n=1}^\infty \int_X f_n \ d\mu.$$
- Let $\{f_n\}$ be a sequence of measurable functions $f_n:(X,\mu) \to \mathbb{C}$. Suppose $\sum_{n=1}^\infty \int_X |f_n|d\mu < \infty$. Then $\sum_{n=1}^\infty f_n(x)$ converges almost everywhere and belongs to $L^1$ and we have $$\int_X \left(\sum_{n=1}^\infty f_n \right) \ d\mu = \sum_{n=1}^\infty \int_X f_n \ d \mu.$$
The first one is a consequence of the monotone convergence theorem, the second one is a consequence of the dominated convergence theorem.
What are some counterexamples that show that the hypotheses of those theorems are necessary?
For example: what counterexample shows that the first result does not hold for functions that are not non-negative? What counterexample shows that the second result does not hold if we don't assume $\sum_{n=1}^\infty \int_X |f_n|d\mu < \infty$?