Meaning of the space $W_0^{1,p}$ I don't understand why the space $W_0^{1,p}(\Omega)$ is defined like the closure of $C^{\infty}_c(\Omega)$ functions and not like the space of $W^{1,p}(\Omega)$ functions with compact support in $\Omega$.
I don't understand if this is a useful definition, and in this case, why this is a useful definition?
Or if there is another reason for this definition.
 A: Let $\Omega \subset \mathbb{R}^N$ be a bounded domain with sufficiently smooth boundary. I will use $W_c^{1,p}(\Omega)$ to denote the Sobolev functions with compact support. First of all, you would have
$$
W_c^{1,p}(\Omega) \subsetneq W_0^{1,p}(\Omega)
$$
One function, which is in $W_0^{1,p}(\Omega)$ but not in $W_c^{1,p}(\Omega)$ is e.g. for $\Omega=B_1(0) \subset \mathbb{R}^2$
$$
f(x)=\frac{1}{4}(1-|x|^2)
$$
You can show that $f \in W_0^{1,p}(\Omega)$ by noting that it is continuous up to the boundary and use the trace operator.
Set $p=2$ for simplicity. Then this function is the weak solution to the BVP
\begin{equation}
\begin{cases}
\Delta f=1 &  \textrm{in } \Omega \\
f=0 &  \textrm{in } \partial \Omega
\end{cases}
\end{equation}
By regularity theory and the maximum principle, this solution is unique in $W_0^{1,p}(\Omega)$. However, we also have
$$
f \notin W_c^{1,p}  (\Omega) 
$$
In other words, the BVP would have no solution in $W_c^{1,p}(\Omega)$, but in $W_0^{1,p}(\Omega)$.
You can also construct the same type of argument for variational problems, just find problems which have no compatly supported function as a solution.
