Consider the interval $[0,1]$ and define $$ X_1:= \left[0, \frac{1}{2}\right], ~~~X_2 := \left[\frac{1}{2}, \frac{3}{4}\right], ~~ X_3 := \left[\frac{3}{4}, \frac{7}{8}\right], ...$$
Define a piecewise constant function as follow : $$ f(x) := \frac{1}{\sqrt{\mu(X_n)}\cdot n}$$ for $x \in X_n$. It seems to me that $f \in L_2[0,1]$ with respect to Lebesgue measure but $f \not\in L_1[0,1]$.
However, this can't be since $[0,1]$ is a finite measured space. Therefore we should have the following inclusion $L_1[0,1] \supseteq L_2[0,1]$. What am I getting wrong here ?
I had the idea of such a function while thinking about the inclusion $\ell_1 \subset \ell_2$. Since $\frac{1}{n} \in \ell_2 \backslash \ell_1$, I thought of adding trying to create a piecewise constant function taking values on this sequence (adding what seems to be appropriate weight) to see what's going on. But I ended up getting quite confused. Please illuminate me.
$\mu(X_n)=2^{-n}$ so for $x\in X_n$ we have $f(x)=2^{n/2}/n$ and $f(x)^2=2^n/n^2.$
So $\int_{X_N}f(x)\;dx=2^{-n/2}n^{-1}$ and $\int_{X_n}f(x)^2\;dx=n^{-2}.$
So $\|f\|_1=\sum_n 2^{-n/2}n^{-1}<\infty$ and $(\|f\|_2)^2=\sum_nn^{-2}<\infty.$