# Subdifferential of a convex function

How would I find a convex function $f: \mathbb{R} \to \mathbb{R}$ such that $\partial f(0) = [0,1]$

A subdifferential is just the collection of vectors $w \in \mathbb{R}^n$ such that

$f(y) \geq f(x_0) + \langle w,y-x_0\rangle$, $\forall y \in \mathbb{R}^n$ and $\partial f(x_0) \neq \emptyset$.

I am unsure how to extend this definition to my question, and would appreciate any help.

• Hint: What is the subdifferential of $|x|$ at $0$? – user99914 Feb 7 '15 at 5:29
• This would be [-1,1] ? – yaweh Feb 7 '15 at 6:49
• Yes, try to use $|x|$ to construct the function you want. – user99914 Feb 7 '15 at 6:59
• Would $$f(x)= \begin{cases} x^2,& \text{if } x\leq 0\\ x, & x > 0 \end{cases}$$ work? – yaweh Feb 7 '15 at 7:31
• haha, definitely. I've familiarised myself with this now, not quite as confusing anymore, thanks =) – yaweh Feb 7 '15 at 8:15

## 1 Answer

I think that

$$f(x) = \begin{cases} 0,&\text{ if } x \leq 0 \\ x,&\text{ if } x > 0 \end{cases}$$

is a good example.