# A function that is less than its average on a neighborhood of every point is convex

Let $f: (a,b) \to \Bbb R$ be a continuous function such that $$\forall x \in (a,b)\; \exists \epsilon_0 \forall \epsilon < \epsilon_0: f(x) \leq \frac{f(x+\epsilon)+f(x-\epsilon)}{2}.$$

Is $f$ necessarily convex?

By definition, $f$ is convex if $$\forall x,y \;\forall t \in [0,1]: f(tx+(1-t)y)\leq tf(x)+(1-t)f(y)$$

so if $f$ is convex it satisfies our property, as can be seen by taking $t=\frac 12, y=x'-\epsilon, x= x'+\epsilon$.

The problem with claiming the converse is tha t the convexity definition is global, while the property is local. On the other hand, the property is on a discrete second derivative and when the function is differentiable we do have a local description of convexity saying exactly the continuous analogue, namely $f'' \geq 0$ at all points.

EDIT

I added the assumption that $f$ is continuous, as this post shows that in general $f$ may not be convex.

Assume the function is not convex. That is, there are $x<y\in (a,b), \lambda_{0} \in (0,1)$ s.t. $f(\lambda_0 y + (1-\lambda_0)x)>\lambda_0 f(y)+(1-\lambda_0)f(x)$. Equivalently, $f(\lambda_0 (y -x) + x) - \lambda_0 (f(y)-f(x)) - f(x) > 0$

Now, define $g:[0,1]\to \Bbb{R}$ by $g(\lambda)=f(\lambda (y -x) + x) - \lambda (f(y)-f(x)) - f(x)$. As $g$ is continuous with compact domain, there is $\lambda^*$ such that maximizes $g$. Hence $g(\lambda^*)\ge g(\lambda_0)>0$, and since $g(0)=g(1)=0, \lambda^* \in (0,1)$.

Now, let $\varepsilon>0$ small enough. We know $$0\le g(\lambda^*) - g(\lambda^*+\varepsilon) \\ = f(\lambda^* (y -x) + x) - \lambda^* (f(y)-f(x)) - f(x)\\ - f((\lambda^* +\varepsilon) (y -x) + x) + (\lambda^*+\varepsilon) (f(y)-f(x)) + f(x)\\ = f(\lambda^* (y -x) + x) - f((\lambda^* +\varepsilon) (y -x) + x) + \varepsilon (f(y)-f(x))$$

and similarly,

$$0\le g(\lambda^*) - g(\lambda^*-\varepsilon) \\ = f(\lambda^* (y -x) + x) - f((\lambda^* -\varepsilon) (y -x) + x) - \varepsilon (f(y)-f(x))$$ where at least one of the inequalities is strict. (*)

Hence $$0< f(\lambda^* (y -x) + x) - f((\lambda^* +\varepsilon) (y -x) + x) + \varepsilon (f(y)-f(x)) \\ + f(\lambda^* (y -x) + x) - f((\lambda^* -\varepsilon) (y -x) + x) - \varepsilon (f(y)-f(x)) \\ = 2f(\lambda^* (y -x) + x) - f((\lambda^* +\varepsilon) (y -x) + x) - f((\lambda^* -\varepsilon) (y -x) + x)$$

Now, if we denote $x^*=\lambda^* (y-x) + x$, and $\epsilon = \varepsilon (y - x)$, we can write the former inequality as $$\frac{f(x^* - \epsilon) + f(x^* + \epsilon)}{2} < f(x^*)$$ which is true for all small enough $\epsilon$. Which is a contradiction.

To justify (*), as pointed out by @Ashkan:

First, let $M=\{\lambda^*\in[0,1]|g(\lambda^*)=\max_{[0,1]}g(\lambda)\}$. This set is nonempty, thus it has a supremum $\bar{\lambda}$. And this supremum is in $M$. To see this, take a sequence $(\lambda^*_n)_n \in M$ s.t. converges to $\bar{\lambda}$. By continuity of $g$, $g(\lambda^*_n)\to g(\bar{\lambda})$, and since $g(\lambda^*_n)=\max_{[0,1]}g(\lambda)$ for all $n$, we deduce $\bar{\lambda}\in M$.

With this, the justification of (*) is that we can take, w.l.o.g, $\lambda^*=\bar{\lambda}$. Hence, for all $\varepsilon>0$, $g(\lambda^*)>g(\lambda^* +\varepsilon)$.

• you should better clarify this "where at least one of the inequalities is strict" – Red shoes Jul 1 '17 at 23:22
• @Ashkan Done. Thanks for pointing this out. – Nate River Jul 2 '17 at 0:02
• It is clear now! Very nice answer. +1 – Fimpellizieri Jul 2 '17 at 0:12
• What a marvelous proof!! +1 And that addendum for showing that one of the inequalities is strict is great. – Paramanand Singh Jul 2 '17 at 1:09