TITLE: Is every convex function on an open interval continuous?
QUESTION [8 upvotes]: Let $f:(a,b)\rightarrow \mathbb{R}$. 
$f$ satisfied the following property:
If $\forall x_{1},x_{0},x_{2}\in(a,b)$ and $x_{1}<x_{0}<x_{2};$then$\frac{f(x_{0})-f(x_{1})}{x_{0}-x_{1}}\geq \frac{f(x_{2})-f(x_{0})}{x_{2}-x_{0}}.$ 
My question : whether the function $f\in C((a,b))?$

We can get  $\displaystyle\frac{f(x_{1})-f(x_{0})}{x_{1}-x_{0}}\geq \frac{f(x_{2})-f(x_{0})}{x_{2}-x_{0}}. $Let $\displaystyle g(x)=\frac{f(x)-f(x_{0})}{x-x_{0}},$ if we can prove $g(x)$ is bound and  decreasing (not strictly ) in $(x_{0}-\delta ,x_{0});$ then we have $f^{'}_{-}(x_{0}) $ exists .In a similar way ,$f^{'}_{+}(x_{0}) $ exists. 
$f^{'}_{-}(x_{0}) $ exists $\Rightarrow\displaystyle\lim_{x\rightarrow x_{0}-}f(x)=f(x_{0});$ $f^{'}_{+}(x_{0}) $ exists $\Rightarrow\displaystyle\lim_{x\rightarrow x_{0}+}f(x)=f(x_{0}).$  Obviously, $f$ is coutinuous at $x=x_{0}.$Further, $f\in C((a,b))!$ 

But  I failed to prove  $g(x)$ is bound and  decreasing (not strictly ) in $(x_{0}-\delta ,x_{0}).$Sometimes  I doubt the conculsion that  $f\in C((a,b)).$
 Either make a counterexample to deny it ,or prove the conculsion is correct?

REPLY [4 votes]: Let $x < y < z$. The inequalities:
\begin{eqnarray*}
\frac{f(y)-f(x)}{y-x} \le \frac{f(z)- f(y)}{z-y} \\
\frac{f(y)-f(x)}{y-x} \le \frac{f(z)- f(x)}{z-x}\\
\frac{f(z)-f(x)}{z-x} \le \frac{f(z)- f(y)}{z-y}
\end{eqnarray*}
are equivalent.
A function $f$ is convex if for any $x<y<z$ in the domain any of the equivalent inequalities from above hold.
It is easy to see now that if $f$ is convex and $x<y$, $x'<y'$ and $x\le x'$, $y\le y'$ then
\begin{eqnarray*}
\frac{f(y)-f(x)}{y-x} \le \frac{f(y')- f(x')}{y'-x'}
\end{eqnarray*}
(the slopes are increasing).
Indeed we have
\begin{eqnarray*}
\frac{f(y)-f(x)}{y-x} \le \frac{f(y')- f(x)}{y'-x}\le \frac{f(y')- f(x')}{y'-x'}
\end{eqnarray*}
Let $[c,d]$ a closed interval contained in $(a,b)$. Let $c'< c$
and $d'>d$ so that $[c,d]\subset[c',d']\subset (a,b)$. For any $x<y$ in $[a,b]$ we have
\begin{eqnarray*}
\frac{f(c)- f(c')}{c - c'} \le \frac{f(y)- f(x)}{y-x}\le \frac{f(d')- f(d)}{d'-d} 
\end{eqnarray*}
Let $M = \max \{ | \frac{f(c)- f(c')}{c - c'} |, | \frac{f(d')- f(d)}{d'-d}|\}$. It follows that
\begin{eqnarray*}
|\frac{f(y)- f(x)}{y-x}|\le M
\end{eqnarray*}
for all $x<y$ in the interval $[c,d]$ so $f$ is Lipschitz on that interval.
Note that $M$ can improved to  $\max\{ |f'_{-}(c)|, |f'_{+}(d)|\}$.
In any case, $f$ is Lipschitz on any closed interval and hence continuous.
$\bf{Added:}$ We can prove that a convex function defined on an open subset of $\mathbb{R}^n$ is Lipschitz on any compact subset, and so continuous. Let's sketch the argument for an open subset of $\mathbb{R}^2$. It is enough to show that is is Lipschitz on any square $S$ contained in the domain. Consider a slightly larger $S'\supset S$ also in the domain. On the boundary of $S'$ and $S$ the function is continuous, so bounded. Take two points $x$, $y$ in $S$. With the argument above we have
$$\frac{|f(x)-f(y)|}{\|x-y\|} \le \frac{2A}{\delta}$$
where $A= \sup_{\partial S \cup \partial S'} |f|$ and $\delta = \operatorname{dist}(\partial S, \partial S')$.
A similar argument with induction on the dimension would show it for convex functions on open subsets of $\mathbb{R}^n$.