Let $I:= (-1, 1)$. We define $g: I \to \mathbb R$ by $$ g(x) := \begin{cases} 1 &\text{if} \quad x\ge 0, \\ -1 &\text{otherwise}. \end{cases} $$
I would like to verify a claim at page 203 of Brezis' Functional Analysis, i.e., $g$ does not belong to $W^{1, p} (I)$ for any $p \in [1, \infty]$.
There are possibly subtle mistakes that I could not recognize in below attempt. Could you please have a check on it?
Assume the contrary that $g \in W^{1, p} (I)$, i.e., there is $h \in L^p(I)$ such that $$ \int_I g \varphi' = - \int_I h \varphi, \quad \forall \varphi \in C_c^1 (I). $$
Then for any $\varphi \in C_c^1 (I)$ we have $$ [\varphi (1) - \varphi (0)] - [\varphi (0) - \varphi (-1)]=\int_{0}^1 \varphi' - \int_{-1}^0 \varphi' = - \int_I h \varphi. $$
Notice that $\varphi \in C_c^1 (I)$ implies $\varphi(-1) = \varphi (1)=0$. Then for any $\varphi \in C_c^1 (I)$ we have $$ 2 \varphi (0) = \int_I h \varphi. $$
There is a sequence $(\varphi_n) \subset C_c^1 (I)$ such that for every $n\in \mathbb N^*$ we have
- $\varphi_n$ is smooth and non-negative,
- $\varphi_n$ is symmetric, i.e., $\varphi_n (x) = \varphi_n (-x)$,
- $\varphi_n (0)=1, \varphi_n \le 1$, and
- $\operatorname{supp} \varphi _n \subset [-\frac{1}{n}, \frac{1}{n}]$.
Then $$ 2 = \int_{-1/n}^{1/n} h \varphi_n \quad \forall n \in \mathbb N^* $$
Because $I$ is bounded, $L^p (I) \subset L^1(I)$ for all $p \in [1, \infty]$. By dominated convergence theorem, $h \varphi_n \to 0$ in $L^1$ and thus $$ \lim_n \int_{-1/n}^{1/n} h \varphi_n=0, $$ which is a contradiction. This completes the proof.