# Example of convex function which is differentiable, but not twice differentiable?

Are there convex functions for which hessian is not defined, but the gradient is defined everywhere?

I was looking at projected gradient descent, as well as Newton's method for solving optimization problem involving linear constraint. In order to justify using projected gradient descent despite it's problem with ill-conditioning, I was looking at cases where function might be convex and differentiable, but not have a hessian defined.

• $f(x)$ given by $0, x<0; x^2, x\ge 0$?
– mfl
Aug 17, 2018 at 21:10
• $\|x\|^{3/2}$ does not have a Hessian at $x={\bf 0}$. Aug 17, 2018 at 21:13

Let $f$ be any nondecreasing and continuous function on $\mathbb R$ that has points of nondifferentiability. Then $F(x)=\int_0^x f$ is an example. You can get pretty wild with this $f;$ for example there is one whose corresponding $F$ fails to be twice differentiable at each rational.
• @SridharThiagarajan Sure it does. $F'=f$ is nondecreasing, therefore $F$ is convex.
Say $f(x) = 0$ for $x<0$ and $x^2$ for $x\geq 0$. It has a derivative at all points, but is not twice differentiable at $0$.