Prove that mean-mode/s.d. lies between -3 and +3 A question in a problem set asks (for any "frequency distribution"),

Show that $-3\le \frac{\text{mean}-\text{mode}}{\text{s.d.}}\le 3$.

I tried by using Pearson's formula for skewness but couldn't proceed.
 A: This is a famous inequality.  As Henry notes in a comment to the question, it can be improved.  I would like to offer these further improvements because they provide insight:


*

*The constants $\pm 3$ can be tightened to $\pm \sqrt{3}$.

*Provided we admit a sufficiently rich class of distributions in our study, these improved constants actually are attained.  This occurs only for uniform distributions (which, by my definition, are bimodal).

*The formula holds for some distributions with multiple modes.  These are distributions for which the mode nearest the mean is "sufficiently far," in a complicated but well-defined sense, from other modes.

*It applies to some non-continuous distributions.  No use is made of a density (PDF) function anywhere in this analysis.  (The definition of a mode, however, does rule out most discrete distributions.)
Most of the ensuing analysis just lays out definitions, many of which are well known, and some simple consequences of them.  The key ideas are contained in (a) finding a suitable definition of "mode" and (b) a simple geometric argument modeled on fundamental ideas of the Calculus of Variations.  Feel free to skip directly to the Solution section to read the denouement.
Those who read Henry's account and this one will note they both use the same basic idea: compare the distribution to a uniform distribution.  The approach I take here wrings a tiny bit more information out of the comparison.  Henry extends his approach to discrete distributions on a lattice, which I do not do.

Preliminaries
Expectations and moments
Any frequency distribution is given by its distribution function $F$, rising from $0$ to $1$ as its argument ranges over the real numbers.  For any function $g$ of the real numbers, define the $F$-expectation of $g$ as
$$E_F(g) = \int_{-\infty}^\infty g(x) \mathrm{d}F(x)$$
(a Lebesgue-Stieltjes integral) provided $g$ is integrable with respect to $F$.  The two functions we will need to deal with are $m_1$ and $m_2$ where, for any integer $k$, $$m_k(x) = x^k$$ is the power function of degree $k$.
Define the survival function of $F$ to be 
$$G(x) = \left\{\eqalign{F(x), &\quad x \lt 0 \\ 1-F(x), &\quad x \ge 0.}\right.$$
Integration by parts establishes that
$$E_F(m_1) = \int_0^\infty G(x)\mathrm{d}x + \int_{-\infty}^0 -G(x) \mathrm{d}x = \mu^{+}+\mu{-}$$
(this is the mean of $F$, expressed as a sum of the "positive mean" $\mu^{+}$ and the "negative mean" $\mu^{-}$, which is a difference of two areas) and
$$E_F(m_2) = \int_0^\infty 2xG(x)\mathrm{d}x + \int_{-\infty}^0 -2x G(x)\mathrm{d}x = \mu_2^{+} + \mu_2^{-}$$
(similarly expressed in terms of two weighted areas, where $2|x|$ serves as the weight), provided all integrals are finite. 
The raw second moment of $F$ is $E_F(m_2)$.  The variance of $F$ is the difference
$$\operatorname{Var}(F) = E_F(m_2) - E_F(m_1)^2.\tag{1}$$
The standard deviation ("s.d.") in the question is the square root of the variance.  
Defining a mode
To avoid limiting arguments, overuse of Calculus, or dealing with special cases, it will be convenient to define a mode with care.  A very general definition with useful ramifications is based on the idea of convexity.  Any function $f$ defined on a subset $\mathcal{A}$ of the real numbers is convex provided that for all pairs $a\le b\in\mathcal{A}$, the graph of $f$ restricted to the interval $[a,b]$ lies on or beneath the line segment connecting the endpoints of that graph, $(a,f(a))$ and $(b,f(b))$. When $-f$ is convex, we say it is concave.
Some special terminology will streamline later arguments.  Let $a\in\mathcal{A}$ be in the interior of the domain of $f$.  I will say that "$f$ is left-convex at $a$" when there is a neighborhood $(a-\epsilon, a)$ on which $f$ is convex.  Similarly, "$f$ is right-concave at $a$" means there is a neighborhood $(a, a+\epsilon)$ on which $f$ is concave.  Finally, $f$ has a mode at  $a$ provided $f$ is left-convex at $a$, right-concave at $a$, but there is no neighborhood of $a$ in which $f$ is either convex or concave.
This definition basically says $f$ looks like the integral of a function that rises to a peak at $a$ and then falls away, but is not horizontal in any neighborhood of $a$.  That not only captures the idea of a mode as a "local peak" of a function, but also helps us define modes of some problematic but important functions.
As an example, let $f$ be the distribution function of a Uniform$[a,b]$ variable.  This means it is zero for $x \le a$, equal to $1$ when $x\ge b$, and rises linearly from $(a,0)$ to $(b,1)$.  

This $f$ has two modes, one at $a$ and the other at $b$.  It is visually evident that $f$ is left-convex at all $x \le b$ and right-concave at all $x \ge a$, and therefore has both properties on the interval $[a,b]$.  However, in the interior of this interval $f$ is both concave and convex.  My definition of a mode rules out all these points, leaving only $a$ and $b$ as modes.
Standardizing and reformulating the problem
To remove that pesky square root, rewrite the inequalities in the form
$$\left(\text{mode}(F) - \text{mean}(F)\right)^2 \le 3 \operatorname{Var}(F).\tag{2}$$
Neither expression changes when $F$ is shifted (that is, it is replaced by the function $x \to F(x-\lambda)$ for some number $\lambda$).  Without any loss of generality we may therefore shift any mode of $F$ to $0$.  With the help of the variance formula $(1)$, the inequalities we wish to prove in $(2)$ simplify to
$$E_F(m_1)^2 \le 3 \operatorname{Var}(F) = 3\left(E_F(m_2)-E_F(m_1)^2\right);$$
that is,
$$E_F(m_1)^2 \le \frac{3}{4}E_F(m_2).\tag{3}$$
This can be attacked in many ways--but how can we use the information that $0$ is a mode?  Since the definition of a mode concerns convexity properties of $F$ in neighborhoods to either side of it, let's break the calculation of the moments $E_F(m_1)$ and $E_F(m_2)$ into two parts.  Here is the formulation in those terms:

By varying the distribution function $F$, minimize $E_F(m_2) = \mu_2^{+} + \mu_2^{-}$ subject to (a) $E_F(m_1)=\mu_1^{+} + \mu_1^{-}$ is constant and (b) $0$ is a mode of $F$.


Solution
We are going to look at each half of $G$ at a time: the argument is the same in either case, so let's consider the positive half of $G$, defined for $x\ge 0$.  Its area is the positive mean $\mu^{+}$.  Another survival function with this area is 
$$H(x) = \left\{\eqalign{G(0)\left(1 - \frac{xG(0)}{2\mu^{+}}\right),&\quad 0\lt x\lt 2\mu^{+}/G(0) \\ 0,&\quad x \ge 2\mu^{+}/G(0)\text{ or } x \le 0.}\right.$$
It descends linearly from a height of $G(0)$ at $x=0$ down to $0$ when $x=2\mu^{+}/G(0)$, thereby enveloping a right triangle.  It is graphed in the right hand panel of the following figure.

If we only assume $G$ is convex on the interval $[0, 2\mu^{+}/G(0)]$, we can be assured that the situation looks like the figure: the graph of $G$ initially lies below that of $H$, and then crosses over it.  Both have the same area.
Compare the weighted integrals $\mu_2^{+}=\int_0^\infty 2x G(x)\mathrm{d}x$ and its $H$ counterpart $\int_0^\infty 2x H(x)\mathrm{d}x$.  Breaking them into the three regions shown in the figure gives
$$\eqalign{&\int_0^\infty 2x H(x)\mathrm{d}x \\&=\int_0^\infty 2x\, \left( \min(H(x),G(x)) + \max(0, H(x)-G(x)) - \max(0, G(x)-H(x))\right)\mathrm{d}x.\tag{4}}$$
The first integral on the right hand side is contributed by the overlapping region beneath both graphs (shaded in yellow and blue).  The second integral corresponds to the part of $H$ above $G$ (shaded in pure yellow).  It replaces the part of $G$ above $H$ at the right, which has been removed (shaded in pure blue). Although the areas of those latter two parts must be the same, the weight $x$ in the first part never exceeds the $x$-value where the graphs cross (somewhere before $2\mu^{+}/G(0)$) while the weight $x$ in the second part is never less than that same $x$-value.  Consequently, $(4)$ cannot be any greater than $\mu_2^{+}$. Indeed, it will be strictly smaller unless $G$ already was equal to $H$.
This construction shows how to keep the area under the right half of $G$ constant while decreasing $\mu_2^{+}$. The same construction on the other side--assuming now that $G$ is convex on the interval $[2\mu^{-}, 0]$--decreases $\mu_2^{-}$ while keeping the area under the left half of $G$ constant.  Consequently, without changing $E_F(\mu_1)$, the value of $E_F(\mu_2)$ can be decreased.
When $H$ and $G$ coincide, then directly from the definition of $H$ we may compute the left hand side of $(4)$ as
$$\mu_2^{+} = \int_0^\infty 2x H(x)\mathrm{d}x  = \int_0^{2\mu^{+}/G(0)} 2x \left( G(0)\left(1 - \frac{xG(0)}{2\mu^{+}}\right)\right) \mathrm{d}x=\frac{4}{3G(0)}\left(\mu^{+}\right)^2.$$
(For the first time we see where that magic constant of $3/4$ in inequality $(3)$ comes from! It is the moment of inertia of a right triangle that arises because its hypotenuse, considered as the graph of a convex function, is the least convex possible of all such graphs subtending a given area.)
Repeating this for the left side of $G$ (which peaks at the limit of $G(x)$ as $x$ approaches $0$ from below, $G(0^{-})$), shows we have obtained the two inequalities
$$\left(\mu^{+}\right)^2 \le G(0) \frac{3}{4}\mu_2^{+};\quad \left(\mu^{-}\right)^2 \le G(0^{-}) \frac{3}{4}\mu_2^{-}.$$
Taken together these imply
$$\eqalign{
E_F(m_1)^2 &= \left(\mu^{+} - \mu^{-}\right)^2 \le \left(\mu^{+}\right)^2 + \left(\mu^{-}\right)^2 \\
&\le \frac{3}{4}\left(G(0)\mu_2^{+} + G(0^{-})\mu_2^{-}\right)\le \frac{3}{4}\max\left(G(0), G(0^{-})\right)\left(\mu_2^{+} + \mu_2^{-}\right) \\ &\le \frac{3}{4}E_F(m_2).
}$$
Equality can hold only when one of $\mu_2^{+}$ and $\mu_2^{-}$ is zero and $G(0)$ is either $0$ or $1$: this makes $G$ the survival function either of a Uniform$(-2\mu^{-}, 0)$ distribution of a Uniform$(0, 2\mu^{+})$ distribution.

The Theorem
Here is what has been shown.

Let $F$ be a distribution with a mode $M$, which (without any loss of generality) is assumed to be $0$ for the purposes of defining the following quantities.  Write $\mu^{+}$ and $\mu^{-}$ for the positive and negative contributions to the expectation of $F$, respectively, so that $E_F(m_1) = \mu^{+} - \mu^{-}$.  Let $G(0)=1-F(0)$ and $G(0^{-})=\lim_{x\to 0^{-}}F(x)$ be the values of the right and left survival functions at $0$, respectively.  Suppose $F$ is convex on the interval $[-2\mu^{-}/G(0^{-}), 0]$ and concave on the interval $[0, 2\mu^{+}/G(0)]$.  (Ignore either condition when the fraction is undefined.) Then the square of the difference between the mean and mode, $(E_F(m_1)-M)^2$, is no greater than three times the variance of $F$.  In particular, this conclusion holds when $F$ has just one mode.  Equality holds if and only if $F$ is a uniform distribution (and therefore $M$ is one of the endpoints of its support.)

