[step:Approximate compactly supported Sobolev functions by mollification]Let $\mathcal{L}^n$ denote $n$-dimensional [Lebesgue measure](/page/Lebesgue%20Measure) on $\mathbb{R}^n$. Let $\rho \in C_c^\infty(B(0,1))$ be a standard non-negative mollifier satisfying
\begin{align*}
\int_{\mathbb{R}^n} \rho(x)\,d\mathcal{L}^n(x)=1.
\end{align*}
For $\varepsilon > 0$, define the mollifier
\begin{align*}
\rho_\varepsilon:\mathbb{R}^n \to [0,\infty), \qquad x \mapsto \varepsilon^{-n}\rho(x/\varepsilon).
\end{align*}
Let $v \in W^{k,p}(U)$ have a representative, still denoted $v$, whose distributional support is the compact set $K \subset U$. Choose $\varepsilon_0 > 0$ such that
\begin{align*}
\varepsilon_0 < \operatorname{dist}(K,\mathbb{R}^n \setminus U).
\end{align*}
Choose $\eta \in C_c^\infty(U)$ such that $\eta=1$ on an open neighbourhood of $K$. Define the zero extension $\tilde v:\mathbb{R}^n \to \mathbb{R}$ by setting $\tilde v=v$ on $U$ and $\tilde v=0$ on $\mathbb{R}^n\setminus U$. For each multi-index $\alpha$ with $|\alpha|\le k$, let $\widetilde{D^\alpha v}:\mathbb{R}^n\to\mathbb{R}$ denote the zero extension of the weak derivative $D^\alpha v$ from $U$ to $\mathbb{R}^n$. Since $\eta v=v$ in $W^{k,p}(U)$ and $\eta v$ has compact support in $U$, the extension agrees with the compactly supported Sobolev function $\eta v$ on $U$ and has no boundary contribution across $\partial U$. Equivalently, testing against any $\phi \in C_c^\infty(\mathbb{R}^n)$ and using the [Basic Properties of the Weak Derivative](/theorems/77) gives $D^\alpha \tilde v=\widetilde{D^\alpha v}$ for every multi-index $\alpha$ with $|\alpha|\le k$, so $\tilde v \in W^{k,p}(\mathbb{R}^n)$.
For $0 < \varepsilon < \varepsilon_0$, define
\begin{align*}
v_\varepsilon:U \to \mathbb{R}, \qquad x \mapsto \int_{\mathbb{R}^n} \rho_\varepsilon(x-y)\tilde v(y)\,d\mathcal{L}^n(y).
\end{align*}
Then $v_\varepsilon \in C^\infty(U)$, and the support condition on $\rho_\varepsilon$ gives $\operatorname{supp} v_\varepsilon \subset U$.
For every multi-index $\alpha \in \mathbb{N}_0^n$ with $|\alpha| \leq k$, the [weak derivative](/page/Weak%20Derivative) satisfies
\begin{align*}
D^\alpha v_\varepsilon = \rho_\varepsilon * D^\alpha \tilde v
\end{align*}
on $U$. Set $g_\alpha:=D^\alpha \tilde v\in L^p(\mathbb{R}^n)$. Since $1\le p<\infty$, translation is continuous in $L^p(\mathbb{R}^n)$. Using the substitution $y=x-\varepsilon z$ in the convolution integral with respect to $\mathcal{L}^n$, [Minkowski's integral inequality](/theorems/464) gives
\begin{align*}
\|\rho_\varepsilon*g_\alpha-g_\alpha\|_{L^p(\mathbb{R}^n)}\le \int_{B(0,1)} \rho(z)\|g_\alpha(\cdot-\varepsilon z)-g_\alpha\|_{L^p(\mathbb{R}^n)}\,d\mathcal{L}^n(z).
\end{align*}
For each fixed $z\in B(0,1)$, the norm inside the integral tends to $0$ by translation continuity. It is bounded by $2\|g_\alpha\|_{L^p(\mathbb{R}^n)}$, and $\rho$ is integrable with respect to $\mathcal{L}^n$, so the [dominated convergence theorem](/theorems/4) yields
\begin{align*}
\|D^\alpha v_\varepsilon - D^\alpha \tilde v\|_{L^p(\mathbb{R}^n)}=\|\rho_\varepsilon*g_\alpha-g_\alpha\|_{L^p(\mathbb{R}^n)} \to 0
\end{align*}
as $\varepsilon \downarrow 0$. Restricting the integral norm from $\mathbb{R}^n$ to $U$ gives
\begin{align*}
\|v_\varepsilon - v\|_{W^{k,p}(U)} \to 0.
\end{align*}[/step]