Yesterday I was dealing with this exercise:
let $K := \{f \in L^2(0,1) : f\ge 0 \}$. Show that K is a closed convex set and that $P_K(f) = f^+$ (Positive part of f).
I already proved that $K$ is convex and closed cause it's trivial to verify that \begin{equation} [f,g] = \{\lambda f + (1-\lambda)g\} \subset K \end{equation}
and also if $\{f_n\}_n \subset K$, $f_n \ge 0$ $\forall n$ and $f = lim_n f_n$ then $f \ge 0$. But to find the orthogonal projection of $f$ on $K$ I should study
\begin{equation} inf_{g \in K} ||f-g||_2 = inf_{g \ge 0} \int_0^1 |f-g|^2 \end{equation}
How should I go on to prove that it coincides to $f^+$?
Let $g \in K$ then \begin{align} ||f-g||_2 &= \int_0^1 |f-g|^2\\ & = \int_0^1 |f^+-f^--g|^2 \\ &= \int_0^1 |-f^-+(f^+-g)|^2\\ &\text{(Hint: This follows from definitions of $f^+, f^-$)} \\ &= \int_0^1 (|-f^-|+|(f^+-g)|)^2 \\ &\geq \int_0^1 (|-f^-|)^2\\ & =\int_0^1 |f-f^+|^2\\ & = ||f-f^+||_2 \end{align}
Hence after taking infimum over all $g \in K$ we get,
$inf_{g\in K} ||f-g||_2=||f-f^+||_2$