# Extend positive function by positive function in Sobolev spaces

This is in connection to this question. I understand the solution, but I want to ask something else regarding the extension of the function. The question is like this:

Suppose that $v$ is a positive real function with $v \in H^1(\Omega)$ and there is a ball $B$ such that $v$ has an extension in $w \in H^1(B)$. Is it true that the extension $w$ can be chosen to be also positive?

The answer is yes. You take an arbitrary extenion of $v$, say $w$ first, then $w_+$ will be the positive extension you want. – Syang Chen Oct 29 '11 at 1:15
In order to expand @Xianghong Chen 's comment, let $w\in H^1(B)$ an extension of $v$. We have to check that $w_+:=\max(w,0)$ is indeed in $H^1(B)$. Put $F_n(x):=\begin{cases}\sqrt{x^2+n^{-2}}-n^{-2}&\mbox{if }x\geq 0\\\ 0&\mbox{otherwise.}\end{cases}$. Then $w_n:=F_n(w)$ is in $H^1(B)$. Since $F_n(0)=0$ and for $x\geq 0$, $|F_n'(x)|=\frac{2x}{2\sqrt{x^2+n^{-2}}}\leq 1$, we have $\nabla w_n =F_n'(w)\nabla w$, and thanks to the dominated convergence theorem we can see that $w_n$ converges to $w_+$ in $L^2(B)$, and $\nabla w_n\to \nabla w\mathbf 1_{\{w(x)>0\}}$ in $L^2(B)$. So $w_+\in H^1(B)$ and is non-negative. $\nabla w_+=0$ where $w<0$, so $w_+>0$ almost everywhere.