Let $X$ be a random variable. Why does the median minimize $E(|X-c|)$?
I know how to prove this given $X$ is either discrete or continuous by directly calculating it. Is there an easier proof that applies to any $X$? Thanks.
Let $X$ be a random variable. Why does the median minimize $E(|X-c|)$?
I know how to prove this given $X$ is either discrete or continuous by directly calculating it. Is there an easier proof that applies to any $X$? Thanks.
So a median $m$ has the property that there is an event $A$ such that $\Pr(A) = 1/2$, and $A \subset \{X\ge m\}$, and $A^c \subset \{X\le m\}$. Then for any constant $c$: $$E|X-m| = E((X-m)(I_A-I_{A^c})) = E((X-c)(I_A-I_{A^c})) + E((m-c)(I_A-I_{A^c})) \le E|X-c|$$ since $|I_A-I_{A^c}| = 1$ and $E((m-c)(I_A-I_{A^c})) = (m-c)(\Pr(A)-\Pr(A^c)) = 0$.