Let $I = (a, b)$ be a (possibly unbounded) open interval of $\mathbb R$. I would like to verify Remark 16(i) at page 218 in Brezis' Functional Analysis
For $u:I \to \mathbb R$, we define $\bar u:\mathbb R \to \mathbb R$ by $$ \bar u (x) := \begin{cases} u (x) &\text{if} \quad x \in I, \\ 0 &\text{if} \quad x \in \mathbb R \setminus I. \end{cases} $$ Let $p \in [1, \infty)$. Then $u \in W^{1, p}_0 (I)$ IFF $\bar u \in W^{1, p} (\mathbb R)$.
Above $W^{1, p}_0 (I)$ is the closure of $C^1_c (I)$ in $W^{1, p} (I)$. There are possibly subtle mistakes that I could not recognize in below attempt. Could you please have a check on it?
WLOG, we assume $I=(0, \infty)$.
- $\implies$
Let $u \in W^{1, p}_0 (I)$. Clearly, $\bar u \in L^p (\mathbb R)$. We define $v$ by $$ v (x) := \begin{cases} u' (x) &\text{if} \quad x \in I, \\ 0 &\text{if} \quad x \in \mathbb R \setminus I. \end{cases} $$
Then $v \in L^p (\mathbb R)$. It follows from $u(0)=0$ that $\bar u (0) = u(0)$ and thus $$ \bar u (x) - \bar u (0) = \int_0^x v(t) dt \quad \forall x \in \mathbb R. $$
Remark 7 The primitive $v$ of a function $g \in L^p (I)$ belongs to $W^{1, p} (I)$ provided we also know that $v \in L^p (I)$, which is always the case when $I$ is bounded.
The claim then follows from Remark 7 (in the same book).
- $\impliedby$
Let $\bar u \in W^{1, p} (\mathbb R)$. Then $u = \bar u |_I \in W^{1, p} (I)$. Clearly, $u(0) = \bar u (0)=0$.
Theorem 8.12 Let $u \in W^{1, p}(I)$. Then $u \in W_0^{1, p}(I)$ if and only if $u=0$ on $\partial I$.
The claim then follows from Theorem 8.12.