Find the subdifferential for $\max\left(x^2,|x|\right)$

convex-analysisnon-smooth-analysissubgradient

We define the function $f:\mathbb R \rightarrow \mathbb R$ as the following:
$$f\left(x\right)=\max\left(x^2,|x|\right)$$
Find the subdifferential $\partial f\left(x\right)$ for all $x\in \mathbb R$.

If we let $S$ be a subset of $\mathbb R^n$. A vector $\xi\in\mathbb R^n$ is called a subgradient for the function $f:S\rightarrow\mathbb R$ at $x_0\in S$ if
$$f\left(x\right)\geq f\left(x_0\right)+\xi^t\left(x-x_0\right)$$
for every $x\in S$. The set of all subgradients of $f$ at $x_0$ is called the subdifferential.

I know that the derivitive doesn't exist at $x_1=-1$, $x_2=0$ and $x_3=1$.

By knowing this we would be able to solve the problem.

For $x_2=0$, we have that:
$$|x| \geq |0|+\xi\left(x-0\right)\Leftrightarrow \xi\in \left[-1, 1\right]$$

For $x_1=-1$:
$$x^2 \geq \left(-1\right)^2+2x\left(x-\left(-1\right)\right)$$
$$x^2 \geq 1+2x^2+2x$$
$$0 \geq 1+x^2+2x$$
$$0 \geq \left(1+x\right)^2$$
Since $u^n \leq 0$, if $n$ is even, then $u=0$, which gives us the following:
$$0 = 1+x \Leftrightarrow x=-1$$
Which is the same for $x_3=1$, so we get that $x=1$. So the subdifferential is given as:
$$\xi=\begin{cases}
-1, & x = -1 \\
\left[-1,1\right], & x=0 \\
1, & x=1
\end{cases}
$$

I am not sure if this is the right way of doing it. I will appreciate it if I can get some help.

Thanks in advance

Best Answer

The subdifferential for $0$ is okay. For $1$ and $-1$ it is not. Consider $x=1$ ($-1$ ist just mirrored).

Then you need to solve $$ 1+\theta(x-1) \leq x^2$$ for $x>1$ and $$ 1+\theta(x-1) \leq x $$ for $0\leq x < 1$.

The first one is satisfied if $\theta\leq \frac{\mathrm d}{\mathrm d x}x^2 |_{x=1} = 2$. The second one is satisfied if $\theta\geq \frac{\mathrm d}{\mathrm d x}x|_{x=1} = 1$. So the subdifferential in $x=1$ is $[1,2]$.