# Characterization of convex functions

From now on $$I$$ will always denote an open interval of $$\mathbb{R}$$

Let $$f \; : \; I \to \mathbb{R}$$ be a function, $$f$$ is said to be convex iff

$$f((1-\gamma)x + \gamma y) \leq (1 - \gamma)f(x) + \gamma f(y) \hspace{0.4cm} \forall x,y \in I \; , \; \forall \gamma \in ]0,1[$$

A well known criterion for convexity is the following

First criterion of convexity If $$f \; I \to \mathbb{R}$$ is a function such that $$(A1)\;\;f'(x) \text{ exists } \;\; \forall x \in I$$ $$(A2)\;\;f'(x) \leq f'(y) \hspace{0.3cm} \forall x,y \in I \; : \; x \leq y$$

Then $$f$$ is convex

The criterion gives a sufficient condition which is not necessary, the example $$f(x) = |x|$$ shows that. I tried to generalize the criterion to find a condition which is sufficient and necessary for the convexity, this is what I managed to do.

Let $$f$$ be a convex function, it can be proved that the function

$$\begin{split} \Phi \; : \; (I \times I) \setminus \Delta &\to \mathbb{R} \\ (x,y) &\mapsto \Phi(x,y) = \frac{f(x) - f(y)}{x - y} \end{split}$$

where $$(I \times I) \setminus \Delta = \{ (x,y) \in I \times I \; : \; x \neq y\}$$

is increasing both in $$x$$ and in $$y$$.

From this property it's pretty easy to show that

$$(B1) \; f'^-(x) \text{ and } f'^+(x) \hspace{0.4cm} \text{ both exists and are finite} \hspace{0.3cm} \forall x \in I$$ $$(B2) \; f'^-(x) \leq f'^+(x) \hspace{0.5cm} \forall x \in I$$ $$(B3) \; f'^+(x) \leq f'^-(y) \hspace{0.5cm} \forall x,y \in I \; : \; x < y$$

where $$f'^-(x) := \lim_{y \to x^-}{\frac{f(x) - f(y)}{x-y}}$$ , $$f'^+(x) := \lim_{y \to x^+}{\frac{f(x) - f(y)}{x-y}}$$

now let $$D := \{ x \in I \; \text{ such that f'(x) doesn't exist} \}$$, in other words $$D$$ is the set of the point of non differentiability of $$f$$ from the properties stated above it's easy to see that

$$D \subseteq \{ \text{ discontinuity points of f'^-} \}$$

and because $$f'^-$$ is increasing ( what I mean with "increasing" is what some people mean with "non-decreasing" ) the discontinuity points of $$f'^-$$ are at most countable, therefore the point of non derivability of $$f$$ are at most countable, therefore $$f$$ is almost everywhere differentiable

So although $$f$$ isn't necessarily everywhere differentiable it is almost everywhere differentiable

Generalized first criterion of convexity Let $$f \; : \; I \to \mathbb{R}$$ be a function, if $$f$$ is convex if then (B1),(B2) and (B3) holds. furthermore the non differentiable points of $$f$$ are at most countable.

My question is, are the condition $$(B1),(B2)$$ and $$(B3)$$ also sufficient for the convexity of $$f$$ ? If so, how can I prove it? If they're not, what is a counterexample?

There is also another criterion of convexity

Second criterion of convexity if $$f \; : \; I \to \mathbb{R}$$ is a function such that $$(C1) f''(x) \;\; \text{ exists } \forall x \in I$$ $$(C2) f''(x) \geq 0 \;\; \forall x \in I$$ then $$f$$ is convex

Can the Second criterion of convexity be generalized in a similar way to the first? Is there a result about the maximum cardinality of the points where $$f$$ isn't twice differentabile ? (similar to the result "the points where $$f$$ isn't differentiable are at most countable")

• Have you checked Rockafellar's Convex Analysis? There are a lot of results on one-sided derivatives etc. Commented Jul 28, 2022 at 16:41
• Some thoughts (it is not appropriate as an answer): Let $I$ be an interval. Let $f : I \to \mathbb{R}$ be a function. Then $f$ is convex on $I$ if and only if $$\frac{f(y) - f(x)}{y - x} \le \frac{f(z) - f(y)}{z - y} \tag{1}$$ for all $x < y < z$ in $I$. Commented Aug 7, 2022 at 6:35

I managed to prove the condition stated by River Li. This proves that the Generalized first criterion of convexity $$\implies$$ convexity

to prove I use this generalized version of the Fermat's stationary point Theorem

Generalized Fermat's stationary point theorem Let $$g \; [0,1] \; \to \mathbb{R}$$ be a function, let $$\gamma_0 \in ]0,1[$$ then

if $$\gamma_0$$ is a local minimum point and if both $$g'^-(\gamma_0)$$ and $$g'^+(\gamma_0)$$ exists, then $$g'^-(\gamma_0) \leq 0 \leq g'^+(\gamma_0)$$

if $$\gamma_0$$ is a local maximum point and if both $$g'^-(\gamma_0)$$ and $$g'^+(\gamma_0)$$ exists, then $$g'^+(\gamma_0) \leq 0 \leq g'^-(\gamma_0)$$

The proof of the Generalized Fermat's stationary point theorem is not very different from the proof of the Standard Fermat's stationary point Theorem

Now to prove the statement I first prove a very useful Lemma

Lemma Let $$f \; : \; I \to \mathbb{R}$$ be a function such that (B1),(B2) and (B3) holds, then

$$f'^+(x) \leq \frac{f(y) - f(x)}{y - x} \leq f'^-(y)$$

forall $$x < y$$ in $$I$$

Proof of the Lemma

Let $$x,y \in I$$ such that $$x < y$$

Let $$g \; : \; [0,1] \to \mathbb{R}$$ defined in this way

$$g(\gamma) := f(x) + \gamma(f(y) - f(x)) - f((1-\gamma)x + \gamma y)$$

I know that $$g(0) = g(1) = 0$$, also $$g$$ is continuos because $$f$$ is continuos ($$f$$ is continuos because the existence of $$f'^+$$ and $$f'^-$$ implies the continuity). It's quite easy to show that for all $$\gamma \in ]0,1[$$ $$g'^+(\gamma$$) and $$g'^-(\gamma)$$ both exists and

$$g'^-(\gamma) = f(y) - f(x) - f'^-((1-\gamma)x + \gamma y)(y - x)$$ $$g'^+(\gamma) = f(y) - f(x) - f'^+((1-\gamma)x + \gamma y)(y - x)$$

It's clear $$g$$ either has an internal maximum point or an internal minimum point.

Maximum point case let's assume that $$g$$ has an internal maximum point, let's call this point $$\gamma_0$$, then thanks to the Generalized Fermat's stationary point theorem I know that

$$g'^+(\gamma_0) \leq 0 \leq g'^-(\gamma_0)$$

meaning

$$f(y) - f(x) - f'^+((1-\gamma_0)x + \gamma_0 y)(y - x) \leq 0$$ $$0 \leq f(y) - f(x) - f'^-((1-\gamma_0)x + \gamma_0 y)(y - x)$$

manipulating these inequalities gives

$$f'^-((1-\gamma_0)x + \gamma_0 y) \leq \frac{f(y) - f(x)}{y - x} \leq f'^+((1-\gamma_0)x + \gamma_0 y)$$

and using (B2) I get

$$f'^+(x) \leq f'^-((1-\gamma_0)x + \gamma_0 y) \leq \frac{f(y) - f(x)}{y - x} \leq f'^+((1-\gamma_0)x + \gamma_0 y)\leq f'^-(y)$$

So in particular

$$\label{disuguaglianza} f'^+(x) \leq \frac{f(y) - f(x)}{y - x} \leq f'^-(y)$$

Minimum point case let's assume that $$g$$ has an internal minimum point, let's call this point $$\gamma_0$$, then thanks to the Generalized Fermat's stationary point theorem I know that

$$g'^-(\gamma_0) \leq 0 \leq g'^+(\gamma_0)$$

meaning

$$f(y) - f(x) - f'^-((1-\gamma_0)x + \gamma_0 y)(y - x) \leq 0$$ $$0 \leq f(y) - f(x) - f'^+((1-\gamma_0)x + \gamma_0 y)(y - x)$$

manipulating these inequalities gives

$$f'^+((1-\gamma_0)x + \gamma_0 y) \leq \frac{f(y) - f(x)}{y - x} \leq f'^-((1-\gamma_0)x + \gamma_0 y)$$

but because of $$(B2)$$ I have that

$$f'^+((1-\gamma_0)x + \gamma_0 y) = \frac{f(y) - f(x)}{y - x} = f'^-((1-\gamma_0)x + \gamma_0 y)$$

and $$f$$ is differentiable in $$(1-\gamma_0)x + \gamma_0y$$, in any case using (B3) i have once again

$$f'^+(x) \leq \frac{f(y) - f(x)}{y - x} \leq f'^-(y)$$

which completes the proof of the Lemma

Now let's dive into the real proof.

Let $$f \; : \; I \to \mathbb{R}$$ be a function such that $$(B1),(B2)$$ and $$(B3)$$ holds, then $$f$$ is convex

Proof*

As I said I will prove the condition stated by River Li, i.e.

$$\frac{f(b) - f(a)}{b - a} \leq \frac{f(c) - f(b)}{c - b}$$

for all $$a < b < c$$ in $$I$$

By using the lemma first with $$x = a, y =b$$ and then with $$x = b , y = c$$ and using (B2) and (B3) I get

$$\frac{f(b) - f(a)}{b - a} \leq f'^-(b) \leq f'^+(b) \leq \frac{f(c) - f(b)}{c - b}$$

which proves

$$\frac{f(b) - f(a)}{b - a} \leq \frac{f(c) - f(b)}{c - b}$$

which proves the convexity of $$f$$.

Therefore the following the Generalized first criterion of convexity is also a sufficient condition for the convexity, therefore the condition (B1),(B2) and (B3) are a complete characterization of the convexity.

Another question still remains, is there a Generalized second criterion of convexity ?