Given that $$f\left(\frac{x+y}{2}\right)\leqslant \frac{f(x)+f(y)}{2}~,$$
how can I show that $f$ is convex.
Thanks.
Edit: I'm sorry for all the confusion. $f$ is assumed to be continuous on an interval $(a,b)$.
convex-analysisreal-analysis
Given that $$f\left(\frac{x+y}{2}\right)\leqslant \frac{f(x)+f(y)}{2}~,$$
how can I show that $f$ is convex.
Thanks.
Edit: I'm sorry for all the confusion. $f$ is assumed to be continuous on an interval $(a,b)$.
Best Answer
Below is the proof of the fact that every midpoint-convex function is rationally convex, which I copied from my older post on a different forum.
If you add the condition that $f$ is continuous, then from rational convexity you will get convexity. (Note that if you are interested only in continuous functions, then it suffices to show the validity of $f(t x + (1-t)y)\le t f(x) + (1-t)f(y)$ for $t=\frac k{2^n}$ as suggested in Jonas' comment. The proof of this fact is a little easier. I've given a little more involved proof, since the relation between midpoint convexity and rational convexity seems to be interesting on its own.)
Maybe I should also mention that midpoint-convex functions are called Jensen convex by some authors.
Note that without some additional conditions on $f$, midpoint convexity does not imply convexity; see this question: Example of a function such that $\varphi\left(\frac{x+y}{2}\right)\leq \frac{\varphi(x)+\varphi(y)}{2}$ but $\varphi$ is not convex
Let $f: \mathbb R\to \mathbb R$ be a midpoint-convex function, i.e. $$f\left(\frac{x+y}2\right) \le \frac{f(x)+f(y)}2$$ for any $x,y \in \mathbb R$.
We will show that then this function fulfills $$f(t x + (1-t)y)\le t f(x) + (1-t)f(y)$$ for any $x,y\in \Bbb R$ and any rational number $t\in\langle0,1\rangle$.
Hint: Cauchy induction: see Wikipedia (current revision) or AoPS or answers to this post.
Proof. It is relatively easy to see that it suffices to show $f([x_1+\dots+x_k]/k)\le [f(x_1)+\dots+f(x_k)]/k$ for any integer $k$ (and any choice of $x_1,\dots,x_k\in \mathbb R$).
The case $k=2^n$ is a straightforward induction.
Now, if $2^{n-1}<k\le 2^n$, then we denote $\overline x=\frac{x_1+\dots+x_k}k$. Now from $$f(\overline x)=f\left(\frac{x_1+\dots+x_k+\overline x+\dots+\overline x}{2^n}\right) \le\frac{f(x_1)+\dots+f(x_k)+(2^n-k)f(\overline x)}{2^n},$$ where $2^n-k$ copies of $\overline x$ are summmed in the middle expression, we get $kf(\overline x) \le f(x_1)+\dots+f(x_k)$ by a simple algebraic manipulation.
The fact that measurability of $f$ is enough for the implication midpoint-convex $\Rightarrow$ convex to hold was mentioned in some of the comments above and in answers to the question I linked. Some references for this fact:
Constantin Niculescu, Lars Erik Persson: Convex functions and their applications, p.60:
Marek Kuczma: An introduction to the theory of functional equations and inequalities, p.241. He mentions the book T. Bonnesen and W. Fenchel, Theorie der konvexen Körper, Berlin, 1934 as an additional reference.