Midpoint-Convex and Continuous Implies Convex

Given that $$f\left(\frac{x+y}{2}\right)\leqslant \frac{f(x)+f(y)}{2}~,$$
how can I show that $f$ is convex.

Edit: I’m sorry for all the confusion. $f$ is assumed to be continuous on an interval $(a,b)$.

Solutions Collecting From Web of "Midpoint-Convex and Continuous Implies Convex"

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

Hint: Cauchy induction: see wikipedia 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:

H. Blumberg [31] and W. Sierpinski [226] have noted independently that
if $f : (a, b) \to \mathbb R$ is measurable and midpoint convex, then $f$ is also continuous
(and thus convex). See [212, pp. 220.221] for related results.

[31] H. Blumberg, On convex functions, Trans. Amer. Math. Soc. 20 (1919), 40–44.

[212] A. W. Roberts and D. E. Varberg, Convex Functions, Academic Press, New York and London, 1973.

[226] W. Sierpinski, Sur les fonctions convexes mesurables, Fund. Math. 1 (1920), 125–129.

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.

Can you provide any more information about $f$? For example, the property holds for continuous functions $f: I \rightarrow \mathbb{R}$, $I$ being an interval of real numbers. I think this result is due to Jensen [1].

Theorem (Jensen).
Let $f: I\rightarrow\mathbb{R}$ be a continuous function. Then $f$ is convex if and only if it is midpoint convex, i.e. for $x,y$ in $I$ we have

f\left(\frac{x+y}{2}\right) \leq \frac{f(x)+f(y)}{2}

[1] J. L. W. V. Jensen, Sur les fonctions convexes et les inégalités entre les valeurs moyennes, Acta Math., 30 (1906), 175-193.

Given a weight lambda, take its binary expansion. Think of what midpoint convexity implies to the inequalities involving the partial sums of this binary expansion. Then the result follows by the continuity of f.