Projection of $H^1([0,1])$ on its subspace . Let $H^1([0,1])$ be the Sobolev space $W^{1,2}([0,1])$ with the scalar product $\langle f,g\rangle = \int_0^1 fg + \int_0^1 f'g'$. We can consider the closed and convex subset $K=\{f \in H^1([0,1] \,\,| \,\, f \ge 0 \}$. How can I find the projection of $H^1([0,1])$ on $K$? 

There is no explicit formula to compute the projection.
The projection of $f\in H^1$ on $K$ is by definition the solution $u$ of
the minimization problem
$$
\min \frac12 \int_0^1 (u'-f')^2 + (u-f)^2 
$$
subject to $u\ge 0$. This is equivalent to find $u\in K$ that solves the variational inequality
$$
\int_0^1 (u'-f')(v'-u') + (u-f)(v-u) \ge 0 \quad \forall v\in K.
$$
There is no closed formula to solve this problem (except for the trivial case $f\in K$).
