# Condition for convexity

Let $f:[a,b]\rightarrow \mathbb R$ be a continuous function such that

$$\frac{f(x) - f(a)}{x-a}$$

is an increasing function of $x\in [a,b]$. Is $f$ necessarily convex? What if we also assume that

$$\frac{f(b) - f(x)}{b-x}$$

is increasing in $x$?

-
I am adding the condition that $f$ be continuous. –  user15464 Jul 18 '12 at 2:21

A counterexample (to both) can be constructed from the function $f(x)=x^2$ on the interval $[0,1]$ by adding a little bump to the graph, say, near the point $(1/2,1/4)$.
Or, more crudely, try $f(x) = x^2$ when $x \in [0,\frac{1}{2}]$, and $f(x) = x^2+1$, when $x \in (\frac{1}{2},1]$. $f$ is not continuous at $x=\frac{1}{2}$, hence it is not convex. –  copper.hat Jul 18 '12 at 2:11
Or for a continuous counterexample, $f(x) = x^2$ on $[0,\frac{1}{2}]$, $f(x) = (x-\frac{1}{2})^2+\frac{3}{4}(x-\frac{1}{2})+\frac{1}{4}$ on $[\frac{1}{2},1]$. A little harder to verify, but it is non-convex, and $\frac{f(x)}{x}$ is increasing. –  copper.hat Jul 18 '12 at 2:27
Yes $f$ is necessarily convex (with the added assumption continuous), if $\displaystyle x\mapsto \frac{f(x)-f(a)}{x-a}$ is increasing over $(a,b]$. Let $a<x<y$ and define $t\in (0,1)$ by $x=ta+(1-t)y$. We have $\displaystyle \frac{f(x)-f(a)}{(1-t)(y-a)} = \frac{f(x)-f(a)}{x-a}\leqslant \frac{f(y)-f(a)}{y-a}$, hence $f(x)\leqslant tf(a) +(1-t)f(y)$.