# Link between mean and median

While doing some experiments today, I ran into the following: $$\mu=m+d$$

where $\mu$ is the arithmetic mean of a set of $N$ values $X=\left\{ x_{i}\right\}$, $m$ is the median of $X$ and $d$ is the median of the distance to the median, i.e.: $$d=\frac{1}{N}\sum_{i=1}^{N}\left|x_{i}-m\right|$$

I am sure this must be a well known result, but I could not find it on the internet. If you know this, can you please send me a link?

At the same time, I have tried to demonstrate it, but could not go further than this, assuming that $N$ is odd, that $X$ is sorted in ascending order, and that the index of $m$ in the sorted dataset is $M=\frac{N+1}{2}$: $$\begin{array}{rcl} m+d & = & m+\frac{1}{N}\sum_{i=1}^{N}\left|x_{i}-m\right|\\ & = & m+\frac{1}{N}\left[\sum_{i=1}^{M-1}\left|x_{i}-m\right|+x_{M}-m+\sum_{i=M+1}^{N}\left|x_{i}-m\right|\right] \end{array}$$

We know by definition that:

• $x_{M}=m$, so $x_{M}-m=0$
• in the sorted dataset, $\forall i=1...M-1,\, x_{i}\leq m$ and $\forall i=M+1...N,\, x_{i}>m$

$$\begin{array}{rcl} m+d & = & m+\frac{1}{N}\left[\sum_{i=1}^{M-1}\left|x_{i}-m\right|+x_{M}-m+\sum_{i=M+1}^{N}\left|x_{i}-m\right|\right]\\ & = & m+\frac{1}{N}\left[\sum_{i=1}^{M-1}\left(m-x_{i}\right)+\sum_{i=M+1}^{N}\left(x_{i}-m\right)\right]\\ & = & m+\frac{1}{N}\left[\left(M-1\right)m-\sum_{i=1}^{M-1}x_{i}+\sum_{i=M+1}^{N}x_{i}-\left(N-M\right)m\right] \end{array}$$

By definition of the median, we know that there are the same number of data on both sides of $m$. This result is confirmed by the fact that , with $M=\frac{N+1}{2}$, $M-1=N-M=\frac{N-1}{2}$. So:

$$\begin{array}{rcl} m+d & = & m+\frac{1}{N}\left[\left(M-2\right)m-\sum_{i=1}^{M-1}x_{i}+\sum_{i=M+1}^{N}x_{i}-\left(N-M-1\right)m\right]\\ & = & m+\frac{1}{N}\left[\sum_{i=M+1}^{N}x_{i}-\sum_{i=1}^{M-1}x_{i}\right] \end{array}$$

But I can not go further...Anyone to help me ? Thanks !

-
Your formula cannot possibly be right as one can easily provide examples of distributions where median is less than the mean (e.g., Bernoulli with $p=0.6$). – StasK Sep 26 '13 at 20:07

$$X = \{1,2,3,4,10000\}$$ $$m = 3\quad \mu = 2002\quad d = 2000.2$$

-
Sorry, I made a mistake in my formula, I was calculating $$d=\frac{1}{N}\sum\left(x_{i}-m\right)$$ (without the absolute value). And in this case, $d+m$ obviously equals $\mu$. Thanks for your answer, it made me realise my mistake. – Gim Sep 26 '13 at 15:44
@GillesM No pb, actually I don't know if that changed anything in your proof, but if you can conclude I'd be interested to read it if you want to edit your OP. – Sh3ljohn Sep 26 '13 at 15:47
Then the prof becomes: $$\begin{array}{rcl} m+d & = & m+\frac{1}{N}\sum_{i=1}^{N}\left(x_{i}-m\right)\\ & = & m+\frac{1}{N}\left[\sum_{i=1}^{N}x_{i}-Nm\right]\\ & = & m-m+\mu\\ & = & \mu \end{array}$$ Was it actually your question ? – Gim Sep 26 '13 at 16:02
@GillesM :) Yes, I didn't try to do it actually, but it's obvious as you showed. – Sh3ljohn Sep 26 '13 at 16:05