# Vanishing on the boundary for Sobolev subspace

Let $W^{m,p}(\Omega) = \{ f \in L^p(\Omega): \partial^\alpha f \in L^p(\Omega) \text{ for multi-indices } |\alpha| \leq m\}$, where $\partial$ denotes the weak derivative. Define $W_0^{m,p}$ to be the closure of $C_c^\infty(\Omega)$ in $W^{m,p}(\Omega)$.

From my understanding, all elements of $W_0^{m,p}$ must vanish on the boundary of $\Omega$, as well as their derivatives up to order $m-1$. I don't quite understand why the derivative of order $m$ need not vanish.

Take for example $m=1$ and $p=2$, with norm $||f||^2_{W^{1,2}}=||f||_{L^2} + ||D^1 f ||_{L^2}$. If $f \in W_0^{1,2}$, then there exists a sequence $f_k \in C^{\infty}_c$ such that $f_k \to f$ in $W^{1,2}$. Thus

$$||f_k - f||_{W^{(1,2)}} = ||f-f_k||_{L^2} + ||D^1 (f-f_k) ||_{L^2} \to 0 \text{ as } k \to \infty$$

Given each $f_k$ has vanishing derivative on the boundary (more so, outside its support), I don't see why $f$ need not have vanishing derivative at the boundary.

I guess this question is an extended question from this post: Some basics of Sobolev spaces

I will try to show you that there exists a function $f\in C^\infty([0,1])$ with $f'(0)=1$, but $f \in W^{1,2}_0(0,1).$ I will skip some details and try to give you the idea of the construction.
Let $f$ be defined as $f(x)=x$ for $0\le x\le 1/2$, then you can see that $f$ can be continued in a $C^\infty$ way up to $1$ so that for example $f(x)=0$ for any $2/3 \le x \le 1.$ For every $k \in \mathbb{N}$ consider now a function $f_k \in C_c^\infty(0,1)$ such that $f_k(x)=f(x)$ for any $1/k\le x\le 1$, $0\le f_k \le f$ and such that $$\sup_{0\le x\le 1/k }|f_k'(x)|\le 2.$$ If you believe that such functions exist then we are done. Indeed $$\|f-f_k \|^2_{L^2(0,1)} = \int_0^1 (f-f_k)^2dx=\int_0^{1/k}(f-f_k)^2dx\le \int_0^{1/k} 4f^2 dx \to 0.$$ Moreover let $M=\sup_{(0,1)} |f'|,$ then $$\|f'-f'_k \|^2_{L^2(0,1)} = \int_0^1 (f'-f'_k)^2dx=\int_0^{1/k}(f-f_k)^2dx\le \int_0^{1/k} (M+2)^2 dx \to 0.$$ Hence $f_k \to f$ in $W^{1,2}(0,1).$