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.
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.