$f(x)=\sin(x)\in H_{0}^{1}(\Omega)$ with $\Omega=(0,\pi)$?

We know that $$f\in C^{\infty}(0,\pi)$$ and $$f(0)=f(\pi)=0$$. But $$supp\ f=[0,\pi]$$. From the definition, $$H_{0}^{1}(0,\pi)$$ is the clusear of $$C_{0}^{\infty}(0,\pi)$$ in $$H^{1}(0,\pi)$$. Since, $$f$$ is not defined outside $$(0,\pi)$$ there is not any point outside the support on which $$f$$ vanish. So how we can say $$f\in H_{0}^{1}(0,\pi)$$?

For $$\epsilon>0$$ small define $$\phi_\epsilon(x)=\max(\sin x-\sin\epsilon,0)$$, $$0. The support of $$\phi_\epsilon$$ is $$[\epsilon,\pi-\epsilon]$$. Its (weak) derivative is $$\phi_\epsilon'(x)=\begin{cases} 0 & 0 It is easy to see that $$\phi_\epsilon\in H_0^1(0\,\pi)$$ and $$\lim_{\epsilon\to0}\|\sin x-\phi_\epsilon(x)\|_{H^1}=0.$$
• Thank you very much @Julián Aguirre. But for each $\epsilon$, $\phi'_{\epsilon}$ is not continuous at $x=\epsilon$. I mean that $\phi_{\epsilon}$ is not in $C_{0}^{\infty}(0,\pi)$ or even in $C_{0}^{1}(0,\pi)$. – Albert May 8 at 12:05
• But it is in $L^2$. – Julián Aguirre May 8 at 13:45
• Yes, of course. But what happens for the definition? We have to find $C^{\infty}$ molifiers. – Albert May 8 at 13:56
• $H_0^1$ is a closed subspace of $H^1$. If a sequence in $H_0^1$ converges in the $H^1$ norm, then its limit is in $H_0^1$. All is needed is to show that each $\phi_\epsilon$ is in fact in $H^1_0$. This can be done by convolution with a compactly supported approximation of the identity. – Julián Aguirre May 9 at 11:31