TITLE: Convexity of an almost twice differentiable fuction
QUESTION [0 upvotes]: Let $f: \mathbb{R}^d \rightarrow \mathbb{R}$ be a function that is twice differentiable almost everywhere. Specifically $f$ is non-differentiable only at the origin, because one term in $f$ contains $\|x\|_{2}$ (not squared). Everywhere else $f$ is twice differentiable with a PSD Hessian. Is it true that $f$ is convex, using the fact that if the Hessian is PSD then the function is convex? Where does the standard reasoning break down if there is a singe point of non-differentiablity at the origin?

REPLY [1 votes]: Consider 
$$
f(x) = \min( (x-1)^2, \ (x+1)^2 ).
$$
It is twice differentiable except at the origin with $f''(x) =2$ for all $x\ne0$. Still it is non-convex.
{"set_name": "stack_exchange", "score": 0, "question_id": 3425593}