Prove that $f\in L^1(A)\Leftrightarrow \sum_{n}^{\infty}m(\{ x\in A : f(x)\geq n \}) < \infty$ I'm stuck with some problem of my Integral Calculation in Several Variables course. The problem goes like this:

Let $A\subset \mathbb{R}$ be a measurable set with $m(A)<\infty$, and $f:A\longrightarrow [0,\infty)$ a Lebesgue-measurable function. Prove that:
  $$f\in L^1(A)\Longleftrightarrow \sum_{n}^{\infty}m(\{ x\in A : f(x)\geq n \}) < \infty.$$

The notation I used is:


*

*$m$ as the Lebesgue measure function

*$L^1(A)=\{ f:A\rightarrow \mathbb{\overline{R}} : \int_{A}|f|\,\mathrm{d}m<+\infty \}$
I've started defining the set $A=f^{-1}([0,\infty))$ as a numerable sum of disjoint measurable sets (because it's said it's measurable) $\sum^{\infty}_{k=0}\cup I_k$, being each $I_k$ the real interval $[k,k+1)$. I imagine I should come to some conclusion like that any unbounded (upper bound) sets of $f(x)$ with $(x\in A)$ have measure $0$.
 A: As stated in the comment you have that
$$
f^{-1}([n,\infty ))= \bigcup_{k\geqslant n}f^{-1}([k,k+1))
$$
Therefore
$$
\begin{align*}
\sum_{n\geqslant 0}m(f^{-1}([n,\infty ))&= \sum_{n\geqslant 0}m\left( \bigcup_{k\geqslant n}f^{-1}([k,k+1))\right)\\
&= \sum_{n\geqslant 0}\sum_{k\geqslant n}m(f^{-1}([k,k+1))\\
&\overset{(*)}{=} \sum_{k\geqslant 0}\sum_{0\leqslant n\leqslant k}m(f^{-1}([k,k+1))\\
&=\sum_{k\geqslant 0}(k+1)m(f^{-1}([k,k+1))\\
&= \sum_{k\geqslant 0}\int(k+1)\mathbf{1}_{f^{-1}([k,k+1)} \mathop{}\!dm\\
&\overset{(**)}{=} \int\sum_{k\geqslant 0}(k+1)\mathbf{1}_{f^{-1}([k,k+1)} \mathop{}\!dm\\
&\geqslant \int f\mathop{}\!dm
\end{align*}
$$
where we used Tonelli's (or the monotone convergence) theorem in $(*)$ and $(**)$. Similarly
$$
\begin{align*}
\int f \mathop{}\!dm &\geqslant \int\sum_{k\geqslant 0}k \,\mathbf{1}_{f^{-1}([k,k+1)}\mathop{}\!dm\\
&=\sum_{k\geqslant 0}k\, m(f^{-1}([k,k+1))\\
&=\sum_{k\geqslant 1}\sum_{1\leqslant n\leqslant k} m(f^{-1}([k,k+1))\\
&= \sum_{n\geqslant 1} \sum_{k\geqslant n}m(f^{-1}([k,k+1))\\
&= \sum_{n\geqslant 1} m(f^{-1}([n,\infty ))
\end{align*}
$$
Finally note that $m(f^{-1}[0,\infty ))= m(A)<\infty $, so the answer is clear.
