I have a question about Sobolev space.


**Let $\Omega$ be an open subset of $\mathbb{R}^{d}$**, 


we consider the Sobolev space


$H^{1}(\Omega):=\left\{ u \in L^{2}(\Omega) : D\_{j}u \in L^{2}(\Omega), j=1,\ldots,n \right\}$


with norm 


$\|u\|^{2}\_{H^{1}(\Omega)}:=\|u\|^{2}\_{L^{2}(\Omega)}+\sum\_{j=1}^{n}\|D\_{j}u\|\_{L^{2}(\Omega)}^{2}$,


where $D\_{j}u=\partial u/ \partial x\_{j}$ is the distributional deriavtive. Moreover, we let 


$X:=\left\{ u|{}\_{\Omega} \in H^{1}(\Omega): u \in C\_{c}(\bar{\Omega})\right\}, $
$Y:=\left\{ u|{}\_{\Omega} \in H^{1}(\Omega): u \in C(\bar{\Omega})\right\},$


where $C\_{c}(\bar{\Omega})$ denotes the space of all continuous real valued functions on $\bar{\Omega}$ with compact support and $C(\bar{\Omega})$ denotes the space of all continuous real valued functions on $\bar{\Omega}$.


**My question**


For any $\epsilon>0$, $f \in Y$, there exists $\varphi \in X$ s.t. $\|f-\varphi\|\_{H^{1}(\Omega)}<\epsilon$ ?


**My attempt 1**


By Tietze extension theorem, we can find $F \in C(\mathbb{R}^{d})$ such that
 $f=F$ on $\bar{\Omega}$. Let $J\_{\delta}F=\int\_{\mathbb{R}^{d}}j\_{\delta}(x-y)F(y)\,dy$, where $j\_{\delta}$ is mollifier. Then $F\_{\delta} \in C\_{c}^{\infty}(\mathbb{R}^{d})$ and $J\_{\delta}F \to f$ in $L^{2}(\Omega)$ as $\delta \to 0$. Futhermore, since $f \in H^{1}(\Omega)$, 
\begin{align\*} 
\frac{\partial}{\partial x\_{i}}J\_{\delta}F-\frac{\partial f}{\partial x\_{i}}&=J\_{\delta}\frac{\partial F}{\partial x\_{i}}-\frac{\partial F}{\partial x\_{i}}\quad \text{on } \Omega \\
& \to 0 \quad \text{in } L^{2}(\Omega).
\end{align\*}
Therefore $\|J\_{\delta}F -f\|\_{H^{1}(\Omega)} \to 0$ as $\delta \to 0$. **But I don't know $J\_{\delta}F \left| \right. \_{\Omega} \in C\_{c}(\bar{\Omega})$. Can we show $J\_{\delta}F \left| \right. \_{\Omega} \in C\_{c}(\bar{\Omega})$ ?**


**My attempt 2**


If there exist open subset $O$ and compact subset $K$ of $\mathbb{R}^{d}$ s.t. $O \subset K \subset \Omega$ and $\|f\|\_{H^{1}(\Omega \setminus K)}<\epsilon$, we take $\psi \in C\_{c}^{\infty}(\mathbb{R}^{d})$ s.t. $\psi=1$ on $O$ and $\psi=0$ on $\mathbb{R}^{d} \setminus K$.


Then 
\begin{align\*}
\|f \psi -f\|\_{H^{1}(\Omega)} &\leq \|f \psi -f\|\_{H^{1}(O)}+\|f \psi -f\|\_{H^{1}(K \setminus O)}+\|f \psi -f\|\_{H^{1}(\Omega \setminus K)} \\
&=\|f -f\|\_{H^{1}(O)}+\|f \psi -f\|\_{H^{1}(K \setminus O)}+\|0 -f\|\_{H^{1}(\Omega \setminus K)} \\
&\leq 0+\|f \psi -f\|\_{H^{1}(K \setminus O)}+\epsilon.
\end{align\*}


**But I don't know how to deal with $\|f \psi -f\|\_{H^{1}(K \setminus O)}$ and existence of such $O,K$.**


If you know, please tell me. Thank you in advance.



Are compactly supported continuous functions dense in the Continuous functions of Sobolev space?
Use cutoff functions as in attempt 2, but construct $\psi$ more carefully. This is a very standard construction.


Start with a function $\psi \in C^\infty\_c(\mathbb{R}^d)$ having $\psi = 1$ on the ball $B(0,1)$, supported inside $B(0,2)$, and with $0 \le \psi \le 1$ everywhere. Let $M = \max\_i \sup\_{B(0,2)} |D\_i \psi|$ which is finite. Set $\psi\_n(x) = \psi(x/n)$. If $f \in Y$ then clearly $\psi\_n f \in X$ for every $n$. Now
$$\|f - \psi\_n f\|\_{H^1}^2 = \|f - \psi\_n f\|\_{L^2}^2 + \sum\_i \|D\_i(f - \psi\_n f)\|\_{L^2}^2.$$
Note that $\psi\_n \to 1$ pointwise and boundedly. Thus $f - \psi\_n f \to 0$ pointwise, and $|f - \psi\_n f|^2 \le |f|^2 \in L^1$ because $f \in L^2$. So by dominated convergence we have $\|f - \psi\_n f\|\_{L^2}^2 = \int |f - \psi\_n f|^2 \to 0$, taking care of the first term.


Next, by the product rule (which is valid for weak derivatives) we have $D\_i(f - \psi\_n f) = (1 - \psi\_n) D\_i f - f D\_i \psi\_n$. As above, since $\psi\_n \to 1$ pointwise and boundedly, and $D\_i f \in L^2$, we get by dominated convergence that $(1 - \psi\_n) D\_i f \to 0$ in $L^2$. Also, $|D\_i \psi\_n| \le M/n$ so $D\_i \psi\_n \to 0$ pointwise and boundedly as well, and $f \in L^2$, so $f D\_i \psi\_n \to 0$ in $L^2$.


We have now shown that $\psi\_n f \to f$ in $H^1$, as desired.


