Density of compactly supported smooth functions in Lp

approximation-theorybanach-spacesfunctional-analysislp-spacesmeasure-theory

This is an exercise in my Functional Analysis book; I tried to check my solution by referring to this site and elsewhere but nowhere have I found a similar argument to mine (which makes me skeptical about my solution; note that I have no access to an instructor and there's no available solutions to this book); the solutions that I have found seem to me more complicated than my following argument (these are just bullet points, not rigorous proof):

First off if $K$ is a compact set (assume WLOG that $K$ is a ball of radius $r$), then note that given any $L^p$ function $f$ on $K$ we can arbitrarily approximate it (in the $L^p$ norm) with a continuous function $g$. Next note that polynomials are uniformly dense in the set of continuous functions, hence there exists a polynomial $p$ which uniformly approximates $g$ on $K$ and hence it can arbitrarily approximate it in the norm (where the integral is taken over $K$ of course).

Now if $f$ is in $L^p(R^n)$ then there exists a set of finite measure $K$ (which WLOG we assume is a ball of radius $r$) such that the integral of $f$ over $K$ is arbitrarily close to its integral over $R^n$. Let us take the continuous function $g$ as above which vanishes outside of $K$ and let $\psi$ be a bump function which is $1$ on a ball of radius $r-\epsilon$ and is supported in $K$, then clearly $p\psi$ can also arbitrarily approximate $g$ in the norm (just like $p$ can). Then by the triangle inequality we obtain the approximation of $f$ by $p\psi$ in the norm.

Is there anything that I'm missing?

Best Answer

Your approach should work in my opinion.

However, you use that continuous functions are dense in $L^p(K)$, but other proofs might not have this fact available to them. Thus, some of the other proofs can look more complicated than yours.

Another approach would be to use mollifiers. This results in a not-too-complicated proof if you are familiar with some basic facts about mollifiers, but complicated otherwise.