Find closed form of minimum We have a function $$g(x) = \min_z \Big[(1-z)_+ + \frac{1}{2\epsilon}(z - x)^2 \Big]$$
How do I find a closed form way to express $g(x)$?
As an example, if $$g(x) = \min_z \Big[|z| + \frac{1}{2\epsilon}(z - x)^2 \Big]$$ then this is \begin{cases}
|x| - \frac{\epsilon}{2},  & \text{if } |x| \geq \epsilon \\
\frac{1}{2\epsilon}x^2, & \text{otherwise}
\end{cases}
I'm actually not sure also how to derive this closed form for the absolute value. I was thinking of splitting it into cases, but I can't seem to solve it.
 A: $\newcommand{\prox}{\operatorname{prox}}\newcommand{\argmin}{\operatorname{argmin}}\newcommand{\dist}{\operatorname{dist}}$This is related to the proximal operator of a closed, convex, proper function $f$, which is defined as 
$$
\prox_{\epsilon f}(v) = \argmin_{z} f(z) + \frac{1}{2\epsilon}\|v-z\|^2.
$$
The corresponding minimum is called the Moreau envelope of $f$. In one dimension, $[x]_+$ is the distance of $x$ to the half line of nonpositive numbers, $(-\infty, 0]$ (which is a closed convex set). We may then use the following identity:
$$
\prox_{t\dist_C(\cdot)}(x) = \begin{cases}
x + \frac{t}{\dist_C(x)}(\Pi_C(x) - x), &\text{for } \dist_C(x) \geq t
\\
\Pi_C(x),&\text{otherwise} 
\end{cases}
$$
where $\Pi_C(x)$ denotes the projection of $x$ onto $C$. In our case $\Pi_{(-\infty, 0]}(x) = -[-x]_+$, so this yields
$$
\prox_{t[{}\cdot{}]_+}(x) = \begin{cases}
x - t, &\text{for } x \geq t
\\
-[-x]_+,&\text{otherwise} 
\end{cases}
$$
Lastly, using the precomposition property of proximal operators, that is,
$$
\prox_{t\phi(ax+b)}(v) = t^{-1}\left(\prox_{a^2t\phi}(av+b) - b\right),
$$
so in our case, for $a=-1$ and $b=1$:
$$
\prox_{t[1-x]_+}(v) = t^{-1}\left(\prox_{t\phi}(1-v) - 1\right),
$$
the desired result is the corresponding Moreau envelope, that is, 
$$
g(x) = \prox_{\epsilon[1-x]_+}(x) + \frac{1}{2\epsilon}(x-\prox_{\epsilon[1-x]_+}(x))^2. 
$$
An interesting exercise would be to generalise the above results when $x\in\mathbb{R}^n$.
