Is there a family of continuous functions $(f\_n)\_{n \in \mathbb{N}}$ on $[0,1]$ whose span is dense in $L^1[0,1]$ for the $L^1$-norm, but not dense in $L^2[0,1]$ for the $L^2$-norm?




---


Some preliminary considerations: I suspect the answer is yes, since there exist a family of $L^2$ functions dense in $L^1$ but not in $L^2$. See my answer to [Completeness of $\{ f\_n : n \in \mathbb N \} \subset C[0,1]$ in $L^1[0,1]$](https://math.stackexchange.com/questions/4348499/completeness-of-f-n-n-in-mathbb-n-subset-c0-1-in-l10-1) that uses the general [Müntz-theorem in $L^p$ spaces (see [Borwein and Erdélyi - The full Müntz Theorem in $C[0,1]$ and $L^1[0,1]$](https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.434.9392)): for $p=1, 2$ and distinct $\lambda\_i > -\frac{1}{p}$,


$$\text{the space $\operatorname{Span}(1, x^{\lambda\_1}, x^{\lambda\_2}, \dotsc)$ is dense in $L^p[0,1]\ \ $ iff $\ \ \sum \limits\_{i=1}^{\infty} \frac{\lambda\_i + 1/p}{(\lambda\_i + 1/p)^2 + 1} = \infty$.}$$


We can take $\lambda\_i = \frac{-1}{2} + \frac{1}{i^2}$ to have the sum diverge for $p=1$ and converge for $p=2$.


For the continuous case however, the Müntz theorem means it's useless to look for a family $(f\_n)$ in the form of power functions. Also, any suitable candidate obviously cannot have a dense span in $\mathcal{C}[0,1]$, which rules out the usual suspects. I think any approach to construct dense families in $L^p[0,1]$ spaces without directly relying on the density of polynomials in $\mathcal{C}[0,1]$ could be useful to study, but I haven't found any.



Functions dense in $L^1[0,1]$ but not in $L^2[0,1]$
$\newcommand{\ep}{\varepsilon}$User Z. M [provided](https://mathoverflow.net/questions/414511/functions-dense-in-l10-1-but-not-in-l20-1#comment1062924_414511) an elegant and brief (and yet complete) detailization of Fedor Petrov's [comment](https://mathoverflow.net/questions/414511/functions-dense-in-l10-1-but-not-in-l20-1#comment1062883_414511).


Here is another detailization, which is pedestrian but explicit.
Let $F:=\{f\_1,f\_2,\dotsc\}$ be any countable subset of $C[0,1]$, which is dense in $C[0,1]$ with respect (w.r.) to the norm $\lVert\cdot\rVert\_\infty$. For instance, $F$ can be the set of all polynomials with rational coefficients. Then $F$ is also dense in $C[0,1]$ w.r. to the norm $\lVert\cdot\rVert\_1$. So, $F$ is dense in $L^1[0,1]$ w.r. to the norm $\lVert\cdot\rVert\_1$.


Let $h(x):=x^{-1/3}$. Then $h\in L^2[0,1]$.


For each natural $n$, we can change the function $f\_n$ to a function $g\_n\in C[0,1]$ such that
$g\_n$ is orthogonal to $h$ and yet $\lVert g\_n-f\_n\rVert\_1\le1/n$, for all $n$ — so that $g\_n$ differs little from $f\_n$ in $L^1$ if $n$ is large. Then clearly the set $G:=\{g\_1,g\_2,\dotsc\}$ will be dense in $L^1[0,1]$, but even the span of $G$ will not be dense in $L^2[0,1]$.


Indeed, let
\begin{equation\*}
 g\_n(x):=
 \begin{cases}f\_n(x)&\text{ if }\ep\_n\le x\le1, \\ 
 f\_n(\ep\_n)-c\_n(\ep\_n-x)&\text{ if }0\le x<\ep\_n,
\end{cases}
\tag{1}\label{-1}
\end{equation\*}
where
\begin{equation\*}
 c\_n:=\frac{I\_n+f\_n(\ep\_n)\frac32\,\ep\_n^{2/3}}{J\_n}=\frac{10}9\,(I\_n\ep\_n^{-5/3}
 +\tfrac32\,f\_n(\ep\_n)\ep\_n^{-1}), 
 \tag{2}\label{0}
\end{equation\*}
\begin{equation\*}
 I\_n:=\int\_{\ep\_n}^1 f\_n h, 
\end{equation\*}
\begin{equation\*}
 J\_n=\int\_0^{\ep\_n}dx\,(\ep\_n-x)h(x)
 =\frac9{10}\,\ep\_n^{5/3},
\end{equation\*}
and $\ep\_n\in(0,1)$ is small enough so that
\begin{equation\*}
 \int\_0^{\ep\_n} |f\_n|\, +\, \|f\_n\|\_\infty\, \ep\_n
 +\frac59\,(\|f\_n\|\_2\,\sqrt 3\,\ep\_n^{1/3}+\tfrac32\,\|f\_n\|\_\infty\,\ep\_n)
 \le\frac1n. \tag{3}\label{1}
\end{equation\*}


Then $g\_n\in C[0,1]$,
\begin{equation\*}
\begin{aligned}
 \lVert g\_n-f\_n\rVert\_1&\le\int\_0^{\ep\_n}dx\,(\lvert f\_n(x)\rvert+\lvert f\_n(\ep\_n)\rvert+\lvert c\_n\rvert(\ep\_n-x)) \\ 
 &\le\int\_0^{\ep\_n} \lvert f\_n\rvert + \lVert f\_n\rVert\_\infty\, \ep\_n + \lvert c\_n\rvert \ep\_n^2/2. 
\end{aligned}
\tag{4}\label{2}
\end{equation\*}
Next, $\lvert I\_n\rvert\le\lVert f\_n\rVert\_2\lVert h\rVert\_2=\lVert f\_n\rVert\_2\,\sqrt3$ and hence, by \eqref{0},  

\begin{equation\*}
 \lvert c\_n\rvert\ep\_n^2/2\le\frac59\,(\lVert f\_n\rVert\_2\,\sqrt3\,\ep\_n^{1/3}+\tfrac32\,\lVert f\_n\rVert\_\infty\,\ep\_n). 
\end{equation\*}
Thus, by \eqref{2} and \eqref{1}, $\lVert g\_n-f\_n\rVert\_1\le1/n$.
Also, by \eqref{-1} and \eqref{0}, $\int\_0^1 g\_n h=0$,
as claimed.


