If $f$ is continuous, why is $f$ with the property $f\left(\frac{x+y}{2}\right)\le \frac{1}{2}f(x)+\frac{1}{2}f(y)$ is convex? 
If $f$ is continuous, why is $f$ with the property
  $$f\left(\frac{x+y}{2}\right)\le \frac{1}{2}f(x)+\frac{1}{2}f(y),$$ where $0\le x,y\le 1$
  is convex?

 A: Turn it around, prove:
If $f$ is continuous and not convex, then it is not midpoint convex.
By assumption, we have $x<y$ and $0 < t < 1$ with
$$f(tx+(1-t)y) > tf(x) + (1-t)f(y).$$
Let $z = tx + (1-t)y$, and on $[x,y]$, consider the function
$$h(w) = f(w) - \frac{y-w}{y-x}f(x) - \frac{w-x}{y-x}f(y).$$
We have $h(x) = h(y) = 0$, and by assumption, $h(z) > 0$. Let $a = \sup \{ x\leqslant w < z : h(w) = 0\}$ and $b = \inf \{ z < w \leqslant y : h(w) = 0\}$.
Then by continuity we have $h(a) = h(b) = 0$, $a < z < b$, and $h > 0$ on $(a,b)$.
Therefore, $h\left(\frac{a+b}{2}\right) > 0$, and since $h(a) = h(b) = 0$, that implies
$$f\left(\frac{a+b}{2}\right) > \frac12 f(a) + \frac12 f(b).$$
A: By induction we can prove that: if $k,m, l\in\mathbb{N} , k+m=2^l , x,y\in \mbox{domain} f $ then $$f\left( \frac{k}{2^l} \cdot x +\frac{m}{2^l} \cdot y \right)\leq \frac{k}{2^l} \cdot f(x) +\frac{m}{2^l} \cdot f(y). $$
Indeed the asertion is true when $l=1 .$ Suppose that it is true for some $l\geq 1 .$ And let $k+m=2^{l+1} , k=2^l +s , m=2^l-s ,s\in\mathbb{N} . $ We have:
$$f\left( \frac{k}{2^{l+1}} \cdot x +\frac{m}{2^{l+1}} \cdot y \right) =f\left( \frac{1}{2} \cdot x +\frac{1}{2}\cdot \left(\frac{s}{2^l} \cdot x+\frac{2^l -s}{2^l} \cdot y\right) \right) \leq \frac{1}{2} \cdot f(x) +\frac{1}{2} \cdot  f\left(\frac{s}{2^l} \cdot x+\frac{2^l -s}{2^l} \cdot y\right)\leq \frac{1}{2} \cdot f(x) +\frac{1}{2} \cdot  \frac{s}{2^l} \cdot f(x)+\frac{1}{2}\cdot\frac{2^l -s}{2^l} \cdot f(y) = \frac{k}{2^{l+1}} \cdot f(x) +\frac{m}{2^{l+1}} \cdot f(y) .$$
Hence  by Induction the asertion holds true for any $l\in\mathbb{N} .$
Now let $1>\alpha >0 , $ and let $\frac{k_l}{2^l} \rightarrow \alpha $ as $l\to \infty .$ Since $f$ continuous we have $$f(\alpha x +(1-\alpha )y ) =\lim_{l\to\infty } f\left(\frac{k_l}{2^l} \cdot x + \left(1-\frac{k_l}{2^l} \right) y\right) \leq \lim_{l\to\infty } \left(\frac{k_l}{2^l} \cdot f(x) + \left( 1-\frac{k_l}{2^l} \right) f(y)\right) =\alpha f(x) +(1-\alpha )f(y) .$$ 
