TITLE: dense subspace of $L^2$ that is disjoint to $L^p$
QUESTION [6 upvotes]: I wonder if it is possible to have a dense subspace $U \subseteq L^2$ that is disjoint to $L^p$ for some $p\neq 2$. I would expect that such $U$ exists, but I'm stuck finding an example.

REPLY [5 votes]: I have tried to solve the problem for the interval $(0,1).$ For $-{1\over 2}<t<-{1\over 3}$ consider the functions
$f_t(x)=x^{t}.$ Then $f_t\in L^2(0,1)\setminus L^3(0,1).$ Let
$$U={\rm span}\, \left \{f_t\,:\, -{1\over 2}<t<-{1\over 3}\right\}$$
Any function $f\in U$ does not belong to $L^3(0,1).$ Indeed, consider a linear combination
$$h:=\lambda_1f_{t_1}+\lambda_2f_{t_2}+\ldots +\lambda_nf_{t_n},\qquad -{1\over 2}<t_1<t_2<\ldots <t_n<-{1\over 3}, \ \lambda_j\neq 0$$ Then
$$h(x)\approx \lambda_1f_{t_1}(x),\qquad x\to 0^+$$
Hence $h\notin L^3(0,1).$
Assume for a contradiction that $U$ is not dense in $L^2(0,1).$ There exists $g\in L^2(0,1)$ such that
$$ \int\limits_0^1x^{t}g(x)\,dx =0,\qquad -{1\over 2}<t<-{1\over 3}$$
Consider the function
$$F(z)=\int\limits_0^1e^{z\log x}g(x)\,dx,\qquad \Re z> -{1\over 2}$$
The function $F(z)$ is holomorphic as the uniform  limit (for $\Re z\ge -{1\over 2}+\varepsilon$)  of holomorphic functions
$$F_\delta(z)=\int\limits_{\delta}^1e^{z\log x}g(x)\,dx,\qquad \delta\to 0^+$$ Indeed,
$$\displaylines{|F(z)-F_\delta(z)|\le \int\limits_0^\delta e^{\Re z\, \log x}|g(x)|\,dx\\ = \int\limits_0^\delta x^{\Re z}\,|g(x)|\,dx  \le \left (\int\limits_0^\delta x^{2\Re z}\,dx\right )^{1/2}\,\|g\|_2}$$
The function $F(z)$ vanishes on the interval $(-1/2,-1/3).$ Therefore it vanishes for any $z,$ $\Re z> -1/2.$ In particular
$$F(n)=\int\limits_0^1t^ng(t)\,dt =0,\quad n\in \mathbb{N}_0$$ By the Weierstrass theorem we get $g=0.$