How to solve this median problem?

129 Views Asked by At

If a distribution of data has median $m$, what are the data that can be added to the distribution and allow the median value to be preserved?

It is clear to me that there are two cases:

a) Odd case $(n+1)/2$.

b) Even case $n/2$ and $n/2 +1$.

But I can't find a way to do this problem literally.

3

There are 3 best solutions below

0
On BEST ANSWER

Suppose you have a dataset of $n$ numbers where $n$ is odd: $x_1, x_2, \ldots, x_n$. Write the numbers in order from least to greatest: $x_{(1)}, x_{(2)}, \ldots, x_{(n)}$. Here $x_{(1)}$ is the minimum value of the dataset and $x_{(n)}$ is the maximum value in the dataset. Since $n$ is odd, the median is located in position $\frac{n+1}{2}$ of the ordered dataset. Thus, $m = x_{\left( \frac{n+1}{2}\right)}$.

Now suppose you add two data points, say $a$ and $b$, to the dataset where $a < m$ and $b > m$. This new dataset consists of $p = n+2$ numbers and since $n$ is odd, it follows that $p$ is also odd. For ease, suppose further that $a < x_{(1)}$ and $b > x_{(n)}$. Using a different letter to label the new dataset, the ordered dataset now looks like $$y_{(1)}, y_{(2)}, \ldots, y_{(p)},$$ where $$y_{(s)} = \begin{cases} a &\text{ if } \quad s=1\\ x_{(s-1)} &\text{ if } \quad 1 < s < p\\ b &\text{ if } \quad s = p \end{cases} $$

Since $p$ is odd, the median, $m'$, is located in position $\frac{p+1}{2}$ of the ordered dataset. Thus, $m' = y_{\left( \frac{p+1}{2} \right)}$. Since $1 < \frac{p+1}{2} < p$, it follows that $m' = x_{\left( \frac{p+1}{2} - 1 \right)} = x_{\left( \frac{n+1}{2} \right)} = m$. So adding $a$ and $b$ to the original dataset did not change the value of the median.

If you would like to remove the assumption that $a < x_{(1)}$ and $b > x_{(n)}$, the way $y_{(s)}$ is defined will change, but the idea will still work. You can use similar reasoning for the case where $n$ is even.

5
On

If you add a number less than the median and also a number greater than the median, it is preserved. Keep doing this in pairs.

1
On

You can always add any data in pairs as long as one is greater than the median and one is less than the median, since the median is the "middle" when you list them in order, putting one at the bottom and one at the top doesn't change the middle point.

In general, you can't put odd data into a list without shifting it. The only exceptions is when the median is repeated.