# Approximating compactly supported L2L^2 functions with Schwartz functions “from within”?

It is well known that the class of Schwartz functions $$S\mathcal{S}$$ in dense in all $$LpL^p$$ spaces therefore for each $$f∈L2f \in L^2$$ there exists a sequence of Schwartz functions $$(fk)(f_k)$$ such that $$‖f−fk‖L2→0\lVert f - f_k \rVert_{L^2} \to 0$$ as $$k→∞k \to \infty$$.

If we suppose further that $$ff$$ has compact support can we find a sequence of Schwartz functions $$(fk)(f_k)$$ such that $$‖f−fk‖L2→0\lVert f - f_k \rVert_{L^2} \to 0$$ as $$k→∞k \to \infty$$ (as above) and additionally $$supp(fk)⊆supp(f)\operatorname{supp}(f_k) \subseteq \operatorname{supp}(f)$$ for all $$kk$$?

No, this is not possible, even if you define $$supp(f)\text{supp}(f)$$ only as an equivalence class (up to a null set). For a counterexample take the characteristic function $$ff$$ of a closed set $$EE$$ of positive measure but without interior points (like that fat Cantor set which Mateusz mentioned).
Indeed, if $$fnf_n$$ is a continuous function with $$supp(fn)⊆supp(f)∪N=E∪N\text{supp}(f_n)\subseteq\text{supp}(f)\cup N=E\cup N$$ for some null set $$NN$$, then $$fn=0f_n=0$$, because otherwise $$E∪NE\cup N$$ would have to contain some interval $$(a,b)(a,b)$$ which must contain a point from the complement of $$EE$$ and which after shrinking (since $$EE$$ is closed) can thus be assumed to lie completely in the complement of $$EE$$, hence $$N⊇(a,b)N\supseteq(a,b)$$, a contradiction.