If $f\in L^2$ then there is $g$ continuous with compact support s.t. $\int (f-g)^2<\varepsilon$

555 Views Asked by At

Let $f\in L^2$ how can I show that for all $\varepsilon>0$ there is $g$ continuous with compact support s.t. $\int (f-g)^2<\varepsilon$ ?

I know that $f\in L^2\implies f^2\in L^1$ and since the function continuous with compact support is dense in $L^1$, if $\varepsilon>0$ there is $g$ continuous with compact support s.t. $\int |f^2-g|<\varepsilon $.

After, I don't know how to continue.

2

There are 2 best solutions below

0
On

Let $K$ be the Hilbert subspace of $L^2$ generated by the continuous compactly supported functions, i.e., the closure of their linear span. This space includes the indicator functions of finite intervals $[a,b]$; this follows from the existence, for arbitrarily small $\epsilon>0,$ of a continuous function $\phi_\epsilon$ that is identically $0$ outside $(a-\epsilon,b+\epsilon),$ identically $1$ on $[a,b]$ and between $0$ and $1$ in the margins.

Let $f_1$ be the orthogonal projection of $f$ on $K.$ Then $f-f_1$ is orthogonal to all indicators of intervals so it must be zero almost everywhere. This implies $f\in K,$ in other words $f$ is an $L^2$ limit of linear combinations of continuous compactly supported functions; note that these linear combinations are themselves continuous and compactly supported.

0
On

Fix a positive mollification kernel $\varphi\in C_c^\infty(\mathbb R)$ satisfying $\displaystyle\int_\mathbb R \varphi(x)\,\mathrm dx =1$. Then set $g=f\star\varphi_\varepsilon$, where $\varphi_\varepsilon(x)=\frac{\varphi(x/\varepsilon)}{\varepsilon}$ and your result follows from $ \|f-f\star\varphi_\varepsilon\|_{L^2}\to0$ as $\varepsilon\to 0$.