Square of a function vanishing outside bounded interval implies function is integrable Prove that if $f$ is a non-negative function that vanishes outside a bounded interval, then $\int_{\mathbb{R}}f^{2}d \lambda < \infty \Rightarrow \int_{\mathbb{R}}f d \lambda < \infty$
Attempt:
Since $f$ vanishes outside of a bounded interval, we only need to consider bounded intervals. $\int_{\mathbb{R}}f^{2}d \lambda = \int f^{2} \chi_{[a,b]}d \lambda$. By definition of the Lebesgue integral we can rewrite this as $\int f^{2 +}\chi_{[a,b]}d \lambda - \int f^{2 -}\chi_{[a,b]}d \lambda$ where $f^{+}(x) = \max\{f(x),0\}$ and $f^{-}(x)=\max\{-f(x),0\}$.
Evaluating the above, I get $(b-a)\max\{f^{2}(x),0\} -(b-a)\max\{-f^{2}(x),0\}$. Now I am not really sure how to proceed (or if I am on the right track?).
EDIT (After Steven's suggestion)： Let $A=\{x:|f(x)| \leq 1\} B=\{x:|f(x)|>1\}$. Then $\int_{\mathbb{R}}f d \lambda = \int_{A}f d \lambda + \int_{B}f d \lambda$. Perhaps I then split this into positive and negative parts and try to somehow use the condition on $f^{2}$?
 A: Given $f$ vanishes outside a bounded interval $A$.
Now using C-S inequality:
$$\int_A f \cdot 1 \, d\lambda \leqslant \left( \int_A f^2 \, d\lambda \right)\left( \int_A \, d\mu \right) = \lambda(A) \int_A f^2 \, d\lambda$$
$$<\infty$$
Here $\lambda(A)=\ell(A)< \infty$ as $A$ is bounded interval and $\int_{A}f^2 d\lambda<\infty$
Hence $f\in L^1(A) $ and $f=0 $ on $\Bbb{R}\setminus A$.
Hence $f\in L^1(\Bbb{R}) $ i.e $\int_{\Bbb{R}}fd\lambda<\infty$
A: I don't think your decomposition will bring you further; note that the negative part  of $f^2$ is zero, so the decomposition accomplishes nothing.
I think the following hint will help you: Consider the integrals of $f$ over the (measurable) subsets where $|f(x)| \leq 1$ and $|f(x)| > 1$, respectively. Using the fact that $f$ vanishes outside an interval and the fact that $\int f^2 < \infty$, you can argue that both these integrals are finite.
EDIT -
The first integral is finite since
$$\left| \int_A f \right| \leq \int_A |f| \leq \int_A 1 = \lambda(A)<\infty, $$
the second is finite since
$$\left| \int_B f \right| \leq \int_B |f| \leq \int_B f^2 \leq \int_{\mathbb{R}} f^2 <\infty. $$
So $\int_A f$ and $\int_B f$ are finite, and so $\int_{\mathbb{R}}f = \int_A f+\int_B f$ is finite.
A: Your question is a special case of the fact that if $(\Omega, \mathcal{F}, \mu)$ is a probability space and $f : \Omega \to [0, \infty)$ is measurable, then the function $m : [1, \infty] \to [0, \infty]$ defined by $m(p) = \|f\|_{L^p} := (\int_{\Omega}|f|^p\,d\mu)^{1/p}$ is increasing. This can be proven by Jensen's inequality or Holder's inequality.
The reason this implies your question is that although a bounded interval does not have measure $1$, you can normalize the measure on the interval to be $1$ and then apply the previous fact to get an inequality.
