Convex functions are continuous.
===
###### tags: `Mathematics` `Convex Function` `Continuous Function`
A function $f:\mathbb{R}\to \mathbb{R}$ is **convex** if for each $\lambda\in [0,1]$,
$$
f(\lambda a +(1-\lambda) b)\leq \lambda f(a)+(1-\lambda)f(b).
$$
:::info
**Lemma.**
Let $f:\mathbb{R}\to \mathbb{R}$ be a convex function and let $a,b,c\in \mathbb{R}$ be real numbers with $a<b<c$. Then we have
$$
\frac{f(b)-f(a)}{b-a}\leq \frac{f(c)-f(a)}{c-a}\leq\frac{f(c)-f(b)}{c-b}
$$
:::
:::warning
**Proof.**
For simplicity, let $\displaystyle\lambda =\frac{c-b}{c-a}$. One can easily check that
$$
b=\lambda a + (1-\lambda)c.
$$
Since $f$ is convex, it follows that
$$
f(b)\leq\lambda f(a)+(1-\lambda)f(c).
$$
We first note that $\lambda f(b)+(1-\lambda)f(b)=f(b)$. This implies
\begin{align}
f(b)-f(a)&\leq \lambda f(a)+(1-\lambda)f(c)-f(a)\\
&=(1-\lambda)[f(c)-f(a)]\\
&=\frac{b-a}{c-a}\left[f(c)-f(a)\right].
\end{align}
Hence, we have
$$
\frac{f(b)-f(a)}{b-a}\leq \frac{f(c)-f(a)}{c-a}.
$$
In the same way, one can easily obtain the second inequality.
:::
Denote
$$
s[x,x']=\frac{f(x')-f(x)}{x'-x}.
$$
The above lemma shows that
$$
s[a,b]\leq s[a,c]\leq [b,c].
$$
:::info
**Lemma.**
Let $f:\mathbb{R}\to \mathbb{R}$ be a convex function and let $a',a,c,c'\in \mathbb{R}$ be real numbers with $a'<a<c<c'$. Then we have
$$
s[a',a]\leq s[x,x']\leq s[c,c']
$$
whenever $a<x<x'<c$.
:::
:::warning
**Proof.**
By the foregoing lemma, we have
$$
s[a',a]\leq s[a',x']\leq s[x,x'] \leq s[x,c']\leq s[c,c'].
$$
:::
Let $m=s[a',a],M=s[c,c']$. Then we have that
$$
m(x'-x)\leq f(x')-f(x)\leq M(x'-x).
$$
Let $C=\max\left(|m|,|M|\right)$. We have
$$
|f(x')-f(x)|\leq C|x'-x|.
$$
This implies that $f$ is a continuous function.
:::info
**Theorem.**
Every convex function is continuous.
:::
A function $f:\mathbb{R}\to \mathbb{R}$ is **concave** if for each $\lambda\in [0,1]$,
$$
f(\lambda a +(1-\lambda) b)\geq \lambda f(a)+(1-\lambda)f(b).
$$
Now, one can easily prove that **every concave function is continuous**.