From Folland "Real Analysis":
"It is instructive to consider following simple examples on $(0, \infty)$ wtih Lebesgue measure. Let $f_a(x) = x^{-a}$, where $a>0.$ Elementary calculus shows that $f_a\chi_{(0,1)}\in L^p$ iff $p<a^{-1}$, and $f_a\chi_{(1, \infty)} \in L^P$ iff $p > a^{-1}$."
I don't quite understand what the author did here.
I know that $f \in L^p$ if $|f|^p$ is Lebesgue integrable. And $$\int|x^{-a}\chi_{(0,1)}|^p = \int|x^{-a}|^p\chi_{(0,1)}.$$
So, for example, if $p = 1/a^2<1/a$, $$\int|x^{-1/a}|\chi_{(0,1)},$$ and this is integrable. But if $p=2/a\ge 1/a,$ $$\int|x^{-2}|\chi_{(0,1)},$$ and this is not integrable.
Could you explain why?
Your computations just prove Folland's claim in the special cases $p = 1/a^2$ (if $a > 1$ otherwise $1/a^2 \geq 1/a$) and $p = 2/a$. The proof of the claim for general $a > 0$ is not much harder. So let us check for which $a >0$ the function $f_a \chi_{(0,1)} \in L^p(0, \infty)$: $$ \int_0^\infty \lvert f_a(x) \chi_{(0,1)}(x)\rvert^p \, \text{d} x = \int_0^1 x^{-ap} \, \text{d}x = \frac{1}{1-ap}\Big[ x^{1-ap} \Big]_{x=0}^{x=1} = \begin{cases} \frac{1}{1-ap}& ap < 1 \\ + \infty & ap > 1 \end{cases}\, . $$ So $f_a \chi_{(0,1)} $ is in $L^p(0, \infty)$ if and only if $ap < 1$, which is the first part of the claim. The proof of the second part is similar.