Are compactly supported continuous functions dense in the Continuous functions of Sobolev space? 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.
 A: 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.
