I've been looking at situations where Jensen's inequality is almost tight, and found myself proving a lemma that I'm nearly certain exists somewhere in the literature.
The specifics are as follows: Suppose we have some convex, increasing function $f(x)$ and a set of $n$ real numbers $x_i$. Define $$ \delta := \frac{\sum f(x_i)}{ n } -f\left(\frac{\sum x_i}{n}\right)$$ We know that $\delta$ is positive by Jensen's, and that it is zero when all the $x_i$'s are equal to the average. Let $\delta$ be positive, but small. We now fix an epsilon, and ask how many $x_i$'s are either greater than $\frac{\sum x_i}{n}(1 + \epsilon)$ or smaller than $\frac{\sum x_i}{n}(1 - \epsilon)$. If we call that set $I$, the lemma would state that $$ |I| \leq g(\delta, \epsilon) n$$ for $g$ continuous, vanishing as delta goes to zero for any fixed $\epsilon$, and depending only on the choice of $f$. What this shows is that if the Jensen's "deficit" is small, then the number of entries that are "far away" from the average is $o(n)$.
Is this some well known (or even not well known, but existent...) lemma?
Thanks! — Matan
EDIT: Made a silly mistake in defining $\delta$ — the body should now contain the correct normalization (Thanks Daniel!)