It is well known that the class of Schwartz functions S in dense in all Lp spaces therefore for each f∈L2 there exists a sequence of Schwartz functions (fk) such that ‖f−fk‖L2→0 as k→∞.
If we suppose further that f has compact support can we find a sequence of Schwartz functions (fk) such that ‖f−fk‖L2→0 as k→∞ (as above) and additionally supp(fk)⊆supp(f) for all k?
Answer
No, this is not possible, even if you define supp(f) only as an equivalence class (up to a null set). For a counterexample take the characteristic function f of a closed set E of positive measure but without interior points (like that fat Cantor set which Mateusz mentioned).
Indeed, if fn is a continuous function with supp(fn)⊆supp(f)∪N=E∪N for some null set N, then fn=0, because otherwise E∪N would have to contain some interval (a,b) which must contain a point from the complement of E and which after shrinking (since E is closed) can thus be assumed to lie completely in the complement of E, hence N⊇(a,b), a contradiction.
Attribution
Source : Link , Question Author : Dominic Shillingford , Answer Author : Martin Väth