An inequation $(\mu-m)^2\leq\sigma^2$ involving expectation, median and variance [duplicate]
I want to prove that:
$$\lvert E[X]-m\rvert \le \sqrt{\text{var}\left(X\right)} $$
where $m$ is the median.
My attempt:
$$ \begin{aligned}&\lvert E[X]-m\rvert \le \sqrt{\text{var}\left(X\right)} \\ &\iff \left( \lvert E[X]-m\rvert \right)^2 \le \text{var}(X) \\ & \iff (E[X]-m)(E[X]-m)\le\text{var}(X) \\ & \iff \left( E[X] \right)^2-2mE[X]+m^2 \le \text{var}(X) \\ &\iff \left( E[X] \right)^2-2mE[X]+m^2 \le E[X^2]-(E[X])^2 \\ & \overbrace{\iff}^{m^2 \ge 0} \left( E[X] \right)^2\color{red}{-2mE[X]} \le E[X^2]-(E[X])^2 \\ &\iff ? \end{aligned}$$
How can I continue this proof? I realize that I problably have to use Jensens inequality: $$f(E[X])\le E[f(X)]$$
at some point but I am having a hard time getting rid of the red term. Since $m$ could be positive, negative or zero, I don't know how to continue.
Solution 1:
Hint:
Medians satisfy the following property:
If $X\in L_1(\mathbb{P})$ and $m$ is a median for $X$ then, $$\mathbb{E}[|X-m|]=\inf_{c\in\mathbb{R}}\mathbb{E}[|X-c|].$$
To see this, notice that $$ \max\{\mathbb{P}[X<m],\mathbb{P}[X>m]\}\leq\frac12 $$ Suppose $m\leq a\leq b$. A simple calculation gives $$|X-b|-|X-a|=2(b-X)\mathbb{1}_{\{a<X\leq b\}}+ (b-a)\big(2\mathbb{1}_{\{X\leq a\}}-1\big)$$ From this, we have \begin{align*} \mathbb{E}[|X-b|]-\mathbb{E}[|X-a|]=2\mathbb{E}[(b-X);a<X\leq b]+(a-b)(1-2\mathbb{P}[X\leq a])\geq 0. \end{align*} Observe that $-m$ is a median for $-X$ whenever $m$ is a median for $X$. Thus, if $b\leq a\leq m$, we have that $\mathbb{E}[|b-X|]\geq \mathbb{E}[|a-X|]$.
Using this argument, if you further assume that $X\in L_2(\mathbb{P})$, then $$|\mathbb{E}[X]-m|\leq\mathbb{E}[|X-m|]\leq \mathbb{E}|X-\mathbb{E}[X]|$$ The problem is then reduced to showing that $\mathbb{E}|X-\mathbb{E}[X]|\leq\sqrt{\operatorname{Var}(X)}$, which is easier. Hope this helps.