Proving that $f\left(\frac{x+y}{2}\right) \le \frac{f(x)+f(y)}{2}$ is convex

general-topologyreal-analysissolution-verification

I'm trying to prove:

$f$ is a continuous real function defined in $(a, b)$ such that $$f\left(\frac{x+y}{2}\right) \le \frac{f(x)+f(y)}{2}$$ for all $x, y \in (a, b) \implies f$ is convex.

I was also given:

A real function $f$ defined in $(a, b)$ is said to be convex if $$f(\lambda x+(1-\lambda)y) \le \lambda f(x)+(1-\lambda)f(y)$$ whenever $a < x, y < b, 0<\lambda < 1$.

My attempt at a proof: Let $x, y \in (a, b)$ and take $f$ be a continuous real function defined in $(a, b)$ such that $$f\left(\frac{x+y}{2}\right) \le \frac{f(x)+f(y)}{2}.$$ Now, suppose to the contrary that $\exists x, y \in (a, b), \lambda \in (0, 1)$ such that $$f(\lambda x+(1-\lambda)y) > \lambda f(x)+(1-\lambda)f(y).$$ We claim that the equation above os satisfied if we take $\lambda = 0.5$, that is, we obtain $$f\left(\frac{x+y}{2}\right) > \frac{f(x)+f(y)}{2}$$ which contradicts the definition of $f$.

Can someone please proofread this proof and let me know if it is accurate? If not, please just point out the error(s); please don't bother to suggest a new proof of this problem.

Best Answer

There is a rather serious error: you are concluding from your assumption of non-convexity that there is some $\lambda \in [0, 1]$ and $x, y$ such that $$f(\lambda x + (1 - \lambda)y) > \lambda f(x) + (1 - \lambda)f(y).$$ This is fine, but then next you assume that this $\lambda = 1/2$. This assumption is erroneous. You can only assume $\lambda \in [0, 1]$, not any specific value of $\lambda$ you wish.

You will absolutely need the continuity assumption too; there are discontinuous counterexamples!