Show that $f$ is integrable iff $\sum\limits_{n\in\mathbb{Z}}2^n \mu(\{x\in S:2^n< \left|f(x)\right|\leq2^{n+1}\})<\infty.$ I can use the following proposition:
Proposition A: For a measurable function $f:S\to\overline{\mathbb{R}}$ the following are equivalent:


*

*i) $f$ is integrable.

*ii) $\left|f\right|$ is integrable.
Now, let $f,g:S\to\overline{\mathbb{R}}$ be measurable functions.
Exercise: Show that $f$ is integrable iff $\sum\limits_{n\in\mathbb{Z}}2^n \mu(\{x\in S:2^n< \left|f(x)\right|\leq2^{n+1}\})<\infty.$
Solution: Let $A_n = \{x\in S:2^n < \left|f(x)\right|\leq 2^{n+1}\}$ for $n\in\mathbb{Z}$. Then the $(A_n)_{n\in\mathbb{Z}}$ are disjoint. Let $C:=\sum\limits_{n\in\mathbb{Z}}2^n\mu(A_n)$. Let $g:=\sum\limits_{n\in\mathbb{Z}}2^{n+1}\mathbb{1}_{A_n}$ and $h:=\sum\limits_{n\in\mathbb{Z}}2^n\mathbb{1}_{A_n}$. Then $h\leq f\leq g$. Moreover, $$\int_Shd\mu=C\,\,\text{ and }\int_Sgd\mu = 2C.$$
From monotonicity we see that $C\leq \int_S \left|f\right|d\mu\leq 2C$, and the required equivalence follows from proposition A.
There's a lot of things about this proof that I don't understand:
Questions:


*

*How do we know that $f(x)\leq g(x)$? I understand that this is true if $x \in A_n$ for some $n\in\mathbb{Z}$, but isn't it possible that there exists an $x$ such that $x\notin A_n$ for any $n\in\mathbb{Z}$? If it's not possible that would mean that $\bigcup\limits_{n\in\mathbb{Z}}A_n = S$, right? But how do we know this is the case?

*Why do we have that $\int_S hd\mu = C$? $h$ is not a simple function right?

*Why do we know that from monotonicity we have that $C\leq \int_S \left|f\right|d\mu\leq 2C$? Isn't this supposed to be $C\leq \int_S fd\mu\leq 2C$, as we know that $h\leq f\leq g$? 

*If I accept that the steps that I questioned above are true, I'm still not done. While I understand that constructing functions $h$ and $g$ in the way that is done in the solution would imply that $f$ is integrable, I don't understand how this proof shows the if and if only part of the exercise. Could you explain why this is the case?
I understand that this is a lot to answer; feel free to present your own explanation that doesn't not directly answer any of the particular questions I posed, but explains the solution in a more general way.
Thanks in advance!
 A: *

*Still thinking.

*From the Monotone Convergence Theorem you get $$\int_{S}h{\rm d} \mu=\int_{S}\left(\sum_{n\in\mathbb{Z}}2^{n}\boldsymbol{1}_{A_{n}}\right){\rm d}\mu=\sum_{n\in\mathbb{Z}}2^{n}\int_{S}\boldsymbol{1}_{A_{n}}{\rm d}\mu=\sum_{n\in\mathbb{Z}}2^{n}\mu\left(A_{m}\right)=C$$

*It is not true that $h\leq f\leq g$, because $f$ can be negative and $h$ can't. In fact, if you'll look again at the definition of $A_{n}$ you'll notice that it involves $\left|f\right|$. Thus instead $h\leq\left|f\right|\leq g$.

*As for the iff part of the question. If $C<\infty$ then you define both $h,g$ and sandwich $\left|f\right|$ between them to show that $\left|f\right|$ and ergo also $f$ are integrable. If $f$ is integrable, then so as $\left|f\right|$, and because $h\leq\left|f\right|$ then $h$ is also integrable and $C<\infty$.
A: Let $x\in S$, since $A_i$ and $A_j$ are disjoint for any $i\neq j$, there must exist an unique $i_x$ such that $x\in A_{i_x}$. For such a $x$ and $i_x$, one has $2^{i_x} \leq f(x) \leq 2^{i_x+1}$. 
Now, for any $x\in S$, one has $f(x) = \sum_n f(x)1_{A_n}$. So that, if $x\in S$, $f(x)=f(x)1_{A_{i_x}}\leq 2^{i_x+1}1_{A_{i_x}}\leq g(x)$, and $f(x) \geq 2^{i_x}1_{A_{i_x}}$. But for any $n\neq i_x$, $1_{A_n}(x)=0$ so summing over $n$ doesn't change the lower bound : $f(x)\geq g(x)$.
