Statement
Let $\Omega \subset \mathbb{R}^n$ be open, $u \in W^{1,2}(\Omega)$ (denoting a Sobolev Space) and $c>0$.
I want to prove that $min(u,c) \in W^{1,2}(\Omega)$. ($c$ denotes a constant function, i.e. $c1_{\Omega}$)
My approaches:
First approach:
I know that for $u \in C^1(\Omega)$ and $\partial_i u = 0$ on $\{u=c\}$ it holds:
$\partial_i min(u,c) = \begin{cases} \partial_i u, & \text{for } u < c \\ 0, & \text{for } u > c \\ 0, & \text{for } u = c. \end{cases}$
So I assume that the weak derivative looks similar. However I'm having trouble to show that the weak derivative of $min(u,c)$ is of the form above. If I do it by the definition I get for $i \in \{1,...,n\}$:
$$\int_{\Omega}min(u(x),c)\partial_i\phi(x) \, dx = \int_{u<c}u(x)\partial_i\phi(x) \, dx + c\int_{u \geq c}\partial_i \phi(x) \, dx$$ However I dont see how this yields any results, since (to my knowledge) neither $1_{u<c}u$ nor $c1_{u \geq c}$ doesn't need to have a weak derivative. (Reason: for $n=1$ and $\Omega = \mathbb{R}^n$ I know, that $u \in W^{1,2}(\Omega)$ needs to be continuous and the $1_{u \geq c}$ clearly isn't.) Another problem would be to prove that $\partial_i u = 0$ on $\{u=c\}$, which I was not able to do yet.
Second approach:
I know that I can rewrite $min(u,c)=\frac{u+c-|u-c|}{2}$. Further I know that for $u \in W^{1,2}(\Omega)$: $|u| \in W^{1,2}(\Omega)$. Problem is that I don't think that $u-c \in W^{1,2}(\Omega)$ in general. So I tried an approximation argument using some kind of chain rule (Stampacchias Theorem, like in If $u \in W^{1,p}(U)$, prove that $Du=0$ a.e. on the set $\{u=0\}$.) but that didn't yield any result yet...
Could somebody please give me a hint?
Let $B\subset \Omega$ be a (non-empty) ball. Then the restriction of $u$ to $B$ is in $W^{1,2}(B)$, and $\min(u,c) \in W^{1,2}(B)$ (since the constant function $c$ on $B$ is in $W^{1,2}(B)$). This proves $u\in W^{1,2}_{loc}(\Omega)$.
The weak derivative of $\min(u,c)$ on $B$ is either zero or equal to that of $u$, so $|D\min(u,c)|\le |Du|$ on $B$, and hence on $\Omega$. This proves $D\min(u,c) \in L^2(\Omega)$.
Since $u\in L^2(D)$, it follows that the set $\Omega_c:=\{x: \ u(x)>c\}$ has finite measure. Then $$ \int_\Omega (\min(u,c))^2 = \int_{\Omega_c} (\min(u,c))^2+\int_{\Omega\setminus \Omega_c} (\min(u,c))^2 = c^2 |\Omega_c| + \int_{\Omega\setminus \Omega_c} u^2 < +\infty. $$ This proves $\min(u,c)\in W^{1,2}(\Omega)$.