# How to check for convexity of function that is not everywhere differentiable?

I have a question. I have just been introduced to the subject of convex sets and convex functions. I read this in wikipedia that a practical test for convexity is - to check whether the 2nd derivative (Hessian matrix) of a continuous differentiable function in the interior of the convex set is non-negative (positive semi-definite).

So how to check for the convexity of functions like $f(x)=|x|$ which is differentiable at all points except at $x=0$ which coincidentally is actually its global minimum?

• The book Boyd and Vandenberghe teaches many techniques for recognizing convex functions. Aug 18, 2014 at 8:03
• I am very new to this course... so I would like a detailed answer that is easy to understand for a layman. Kindly please help if possible.
– roni
Aug 18, 2014 at 10:25
– Did
Aug 18, 2014 at 11:05
• It never hurts to know a bunch of inequalities with which to prove the convexity inequality you're aiming for. Aug 18, 2014 at 11:07

One option is to check directly that the definition of a convex function is satisfied.

It's useful to know that any norm on $\mathbb R^n$ is a convex function. Proof: If $x,y \in \mathbb R^n$ and $0 \leq \theta \leq 1$, then \begin{align*} \| \theta x + (1 - \theta) y \| & \leq \| \theta x \| + \| (1 - \theta) y \| \\ &= \theta \| x \| + (1 - \theta) \| y \|. \end{align*} This shows that the definition of a convex function is satisfied.

When $n = 1$, the $2$-norm is just the absolute value function $f(x) = | x |$. This shows that the absolute value function is convex.

A bunch of other techniques for recognizing convex functions are explained in the book Boyd and Vandenberghe (free online).

• +1. Frankly, the derivative test is not particularly helpful in practice. Instead, most of the time you're proving the convexity of functions by showing how it is built up from other convex and concave functions in certain "convexity-preserving" ways. This "building block" approach to proving convexity is described in detail in Chapter 3 of B&V. Aug 21, 2014 at 17:50

It suffices to write $f$ as the pointwise supremum of some family of affine functions, here $f=\sup\{g,h\}$ with $g:x\mapsto x$ and $h:x\mapsto-x$, since every such supremum defines a convex function and every convex function can be written as such a supremum.

• This is definitely a very effective method, whenever it is applicable. Aug 18, 2014 at 11:21