So let us consider the following minimization problem parametrized in $z$
\begin{align*} \min_{x \in \mathbb{R}} L_z(x) = \frac{1}{2} \left(x - z\right)^2 + |x| \end{align*}
The goal is to then find the minimizer when $z \in [-1,1]$. I will lay out my solution and why I am uncertain about how I got there. So if we find the gradient to look for critical points, we get that
\begin{align*} \frac{d L_z}{dx}(x^*) = 0 = \begin{cases} (x^* - z) + 1 & x^* \geq 0 \\ (x^* - z) - 1 & x^* < 0 \end{cases} \end{align*}
and so we find that the case-wise critical point is
\begin{align*} x^* = \begin{cases} z - 1 & x^* \geq 0 \\ z + 1 & x^* < 0 \end{cases} \end{align*}
If we look at the case that $x^* \geq 0$ and the fact that $z \in [-1,1]$, we find that $-2 \leq x^* \leq 0$. If we look at the latter case and the fact that $z \in [-1,1]$, we find that $0 \leq x^* \leq 2$.
Taking both of these inequalities into account, we find that $0 \leq x^* \leq 0$ and thus $x^* = 0$ $\forall z \in [-1,1]$. This is validated if one write a program to solve the problem.
My issue is I feel like I should have been explicitly taking into account the case inequalities such as $x^* \geq 0$ for the first case and $x^* < 0$ for the second case. Can anyone explain why this is or is not important to do and how I should be using it if it is necessary?