As the title states, I need to find a solution to
$$\min_{v\in L^2(0,1)} \|v-w\|^2_{L(0,1)}$$
s.t. $v(x) \geq 0 $ almost everywhere,
where $w \in L^2(0,1)$ is given.
$L^2(0,1)$ is the lebesgue space
I know that there is a solution if $v$ was bounded to a convex and bounded subset of $L^2(0,1)$ and there were no additional constraints.
So my idea was to somehow put the constraint $v(x) \geq 0$ into the set over which we minimize since $ L^2(0,1)$ is allready a convex set(right?). However I do not really seem to get far with this.
Hint :
$$||v-w||^{2}_{L^2(0,1)}=\int_{\{x \in(0,1),w(x) \ge 0 \}} |v(x)-w(x)|^2dx+\int_{\{x \in(0,1),w(x) < 0 \}} |v(x)-w(x)|^2dx.$$
How would you chose $v$ on $\{x \in(0,1),w(x) \ge 0 \}$ such that $\int_{\{x \in(0,1),w(x) \ge 0 \}} |v(x)-w(x)|^2dx$ is minimal ? And what about the other set ?