Suppose I have the convex function $f(x) = |x|$ over the domain $x \in [-1,1]$, and I wish to find the subgradient.
It is easy to find the subgradient in the interior of the domain. At the boundaries, I can see that $\partial{}f(-1) = \{-\infty,-1\}$, and $\partial{}f(1) = \{1,\infty\}$ by sketching the function. However, I am not sure how to show this mathematically, due to the discontinuity.
How can I prove this? Thanks!
Let's calculate the subgradient $D_1$ at $x=1$.
Let's prove that $D_1 \subset [1,+\infty[$ : Let $c \in D_1$, then $f(0) - f(1) \geq c ( 0-1)$, so $-1 \geq -c$, hence $c \geq 1$.
Let's prove that $[1,+\infty[ \subset D_1$ : Let $ c\geq 1$, then
$\forall x \in [0,1], f(x)-f(1) = x-1 \geq 1.(x-1)$
$\forall x \in [-1,0], f(x)-f(1) = |x|-1 \geq -1 \geq 1.(x-1)$
So $\forall x \in [-1,1], f(x)-f(1) \geq 1.(x-1)$, hence $x\in D_1$
Edit : by the way, there is no discontinuity at $x=1$.