If $f$ is continuous and $\,f\big(\frac{1}2(x+y)\big) \le \frac{1}{2}\big(\,f(x)+f(y)\big)$, then $f$ is convex Let $\,\,f :\mathbb R \to \mathbb R$ be a continuous function such that $$
f\Big(\dfrac{x+y}2\Big) \le \dfrac{1}{2}\big(\,f(x)+f(y)\big) ,\,\, \text{for all}\,\, x,y \in \mathbb R,
$$
then 
how do we prove that $f$ is convex that is
$$
f\big(tx+(1-t)y\big)\le tf(x)+(1-t)f(y) , \forall x,y \in \mathbb R , t\in (0,1)?
$$
I can prove it for dyadic rational's $t=\dfrac k {2^n}$ and then argue by continuity ; but I would like a more direct proof . Thanks in Advance 


I would like to properly show by induction that if $ m\in\{0,1,2,\ldots,2^{n}\} $ then
$$
f\left(\frac{m}{2^n}x+\Big(1-\frac{m}{2^n}\Big)y\right)\le \frac{m}{2^n}f(x)
+\Big(1-\frac{m}{2^n}\Big)f(y). 
$$
and then the result will follows by contuinity since $$ m=\lfloor2^nt\rfloor \in\{0,1,2,\ldots,2^{n}\} ~~~and~~\frac{\lfloor2^nt\rfloor}{2^n}\to t$$


The initial state $n = 1$ is trivial by hypothesis.
Now we assume that for every $k<n$,  whenever $m\in\{0,1,2,\ldots,2^{k-1}\}$,we have
$$
f\left(\frac{m}{2^k}x+\Big(1-\frac{m}{2^k}\Big)y\right)\le \frac{m}{2^k}f(x)
+\Big(1-\frac{m}{2^k}\Big)f(y). \tag{I}\label{I}
$$
we want to prove \eqref{I} for $k=n$.
Let $m \in\{0,1,2,\ldots,2^{n}\}$ then the division  by 2 yields $m =2p +r$ with $r\in \{0,1\}$
$$X:=\left(\frac{m}{2^n}x+\Big(1-\frac{m}{2^n}\Big)y\right)= \left(\frac{2p +r}{2^n}x+\Big(1-\frac{2p +r}{2^n}\Big)y\right) \\= \left(\frac{p }{2^n}x+\frac{p +r}{2^n}x+\Big(1-\frac{p }{2^n}y-\frac{p +r}{2^n}y\Big)y\right)
\\= \frac12 \left(\frac{p }{2^{n-1}}x+\frac{p +r}{2^{n-1}}x+\Big(2-\frac{p }{2^{n-1}}y-\frac{p +r}{2^{n-1}}y\Big)y\right)
\\=\frac12\left(\frac{p }{2^{n-1}}x+ \Big(1-\frac{p }{2^{n-1}}y\Big)\right)+\frac12\left(\frac{p+r }{2^{n-1}}x+ \Big(1-\frac{p +r}{2^{n-1}}y\Big)\right) \\:=
\color{red}{\frac{1}{2}\left(X_1+X_2\right)}$$
On the other hand, since $r\in \{0,1\}$ and $m\in\{0,1,2,\ldots,2^{n}\}$ it is to check using parity that $p,p+1 \in \{0,1,2,\ldots,2^{n-1}\}$
that is $p,p+r \in \{0,1,2,\ldots,2^{n-1}\}$
By hypothesis of induction we obtain
\begin{align}f(X) &= f\left(\frac{1}{2}\left(X_1+X_2\right)\right)\le \frac12f(X_1) +\frac12f(X_2) \\&=
\frac12f\left(\frac{p }{2^{n-1}}x+ \Big(1-\frac{p }{2^{n-1}}y\Big)\right)+\frac12f\left(\frac{p+r }{2^{n-1}}x+ \Big(1-\frac{p +r}{2^{n-1}}y\Big)\right)
\\&\le\frac12\left(\frac{p }{2^{n-1}}f(x)+ \Big(1-\frac{p }{2^{n-1}}f(y)\Big)\right)+\frac12\left(\frac{p+r }{2^{n-1}}f(x)+ \Big(1-\frac{p +r}{2^{n-1}}f(y)\Big)\right) \\&= \frac{2p+r}{2^n}f(x)
+\Big(1-\frac{2p+r}{2^n}\Big)f(y)\\&= \frac{m}{2^n}f(x)
+\Big(1-\frac{m}{2^n}\Big)f(y).\end{align}
