I want to compute the Moreau Envelope of the function $f(y) = \max(0,y)$. I know that the Moreau Envelope is given by:
$f_t(x) = \inf_y \{ f(y) + \frac{1}{2t}(x-y)^2 \ | y \in \mathbb{R} \}$
In our case this is:
$f_t(x) = \inf_y \{ \max(0,y) + \frac{1}{2t}(x-y)^2 | y \in \mathbb{R} \}$
Now everything left is computing the infimum. However, somehow I am messing up this step.
I thought about a case distinction with:
- $y < 0$
- $y > 0$
- $y = 0$
But this led to nowhere. Any help?
Guide:
Assuming $t>0$.
If $x\le 0$, the infimum is attained when $y=x$, then we have $$f_t(x)=0.$$
Now, we focus on the case where $x>0$,
If $y \le 0$, $\max(0,y)+\frac1{2t}(x-y)^2=\frac1{2t}(x-y)^2 \ge \frac{x^2}{2t}$
For $y\ge 0$, notice that it is a trade off between the the norm of $y$ and the approximation of $x$. If $y>x$, we could have find a better solution that is less than $x$ and have a smaller norm in $y$. To be explicit, the expression is evaluate to be $$y+\frac1{2t}(x-y)^2$$
which is a quadratic equation subject to the constraint that $y > 0$. Try to find the minimal of this problem.
Edit:
\begin{align}y + \frac1{2t}(x-y)^2 &=\frac1{2t}(x^2-2xy+y^2+2ty)\\ &=\frac1{2t}(y^2+2(t-x)y+x^2)\\ &=\frac1{2t}\left((y+(t-x))^2+x^2-(t-x)^2\right)\\ &=\frac1{2t}\left((y+(t-x))^2-t^2+2tx\right)\\ &=\frac1{2t}((y-(x-t))^2-\frac{t}2+x\end{align}
$\max(0,y)+\frac{1}{2t}(x-y)^2$ is a continuous function in $y$, when $x-t>0$, the minimal is attained there, and the minimal value is $x-\frac{t}2$. Otherwise, the minimal is attained when $y=0$ with value $\frac{x^2}{2t}.$