Let $p\in [1,\infty)$.Prove that $f\in L^p(\mu)$ if and only if
$\sum_{n=1}^\infty(2^n)^p\mu (\{x:|f(x)|\gt2^n\})\lt \infty.$
My idea, I assume measure is finite, I wrote $A_n=\{x:|f(x)|\gt2^n\}$,which is decreasing sequence of sets. Its clear that $x$ can't be in all of $A_n$ otherwise $f$ would infinite which we don't want because $f$ is in $L^p$. And i tried some identity using kai function then i messed up. Do you have any specific idea for this? I would appreciate any kind of help.
The sum must extend over all integers, by the way, otherwise, it would be finite (namely $0$) for a constant function whose value is less than $1$ in modulus.
Then, with $B_n = \{x : 2^n < \lvert f(x)\rvert \leqslant 2^{n+1}\}$, we have
$$A_n = \{ x : 2^n < \lvert f(x)\rvert\} = \bigcup_{k=n}^\infty B_k,$$
and the union is disjoint. Thus
$$\begin{align} \sum_{n\in \mathbb{Z}} (2^n)^p \mu(A_n) &= \sum_{n\in \mathbb{Z}} (2^n)^p \sum_{k=n}^\infty \mu(B_k)\\ &= \sum_{k\in \mathbb{Z}} \left(\sum_{n=-\infty}^k (2^n)^p\right)\mu(B_k). \end{align}$$
Now the inner sum can be evaluated explicitly (it is a geometric series), and the relation to the integral
$$\int_X \lvert f(x)\rvert^p\,d\mu$$
should be easy to discover.