6. Median of the sum of numerical sets. Let there be two numerical sets:

$$
X=\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \text { and } Y=\left\{y_{1}, y_{2}, \ldots, y_{m}\right\}
$$

The first set has $n$ numbers, and the second set has $m$ numbers. The direct sum or simply the sum $X \oplus Y$ of these sets is the set consisting of all possible sums $x_{k}+y_{j}$. The set $X \oplus Y$ contains exactly $m n$ numbers. The sum of the sets can be conveniently represented as a table. Figure 5 shows the sum of the sets $X=\{1,2,3\}$ and $Y=\{0,4,5\}$. If we write this sum in a row and sort it in ascending order, we get

![](https://cdn.mathpix.com/cropped/2024_05_06_aa973e43eb29b804d001g-02.jpg?height=386&width=345&top_left_y=1763&top_left_x=1575)

Sum of the sets

Figure 5 $X \oplus Y=\{1,2,3,5,6,6,7,7,8\}$.

Consider the medians of these sets and the median of their sum. The median of the first set is $M_{x}=2$, the median of the second set is $M_{Y}=4$, and the median of their sum is $M_{X \oplus Y}=6$ (all three medians are highlighted in the figure). We get the equality $M_{X \oplus Y}=M_{X}+M_{Y}$. Is the median of the sum always equal to the sum of the medians?

a) (From 6th grade, 1 point) Provide an example of two numerical sets where the median of their sum differs from the sum of their medians by 1.

b) (From 6th grade, 3 points) Once, a Distracted Scientist was studying two mysterious numerical sets. Nothing is known about the first set, but about the second set, it is known that its smallest value is 1 and its largest value is 5. Despite the scarcity of these data, the Scientist, through complex calculations, found that the median of the sum of these two sets is 4.5 greater than the sum of their medians. Is this possible? Provide an example of such two sets or prove that they do not exist.
Solution. a) For example, two identical sets: $X=\{0,0,1\}$ and $Y=\{0,0,1\}$. The median of each is 0, and the sum of these sets $\{0,0,0,0,1,1,1,1,2\}$ has a median of 1.

b) We will show that such sets do not exist. Let the first set $X$ consist of numbers $x_{1}, x_{2}, \ldots, x_{n}$, and the second set $Y$ consist of numbers $y_{1}, y_{2}, \ldots, y_{m}$.

The sum of these sets $X \oplus Y$ consists of all possible sums $x_{k}+y_{j}$. Replace each term $y_{j}$ with the maximum value 5. This results in a set where the number $x_{1}+5$ appears $m$ times, the number $x_{2}+5$ appears $m$ times, and so on.

The median of the resulting set is $M_{X}+5$. This number is not less than the median of the sum $X \oplus Y$, since by replacing the terms $y_{j}$ in the sums $x_{k}+y_{j}$ with 5, we do not decrease any number (some are increased), and thus the median does not decrease. Therefore,

$$
M_{X \oplus Y} \leq M_{X}+5
$$

On the other hand, the smallest value in set $Y$ is 1, so the median of this set is not less than 1: $M_{Y} \geq 1$. Consequently,

$$
M_{X}+M_{Y} \geq M_{X}+1
$$

From the two inequalities obtained, it follows that

$$
M_{X \oplus Y}-\left(M_{X}+M_{Y}\right) \leq M_{X}+5-\left(M_{X}+1\right)=4
$$

The difference is no more than 4 and, therefore, cannot equal 4.5. Such sets do not exist. The Absent-Minded Scholar must have made a mistake in his calculations.

Answer: a) for example, two identical sets $\{0,0,1\}$ and $\{0,0,1\}$; b) this is impossible.

Note. It can be shown in general that for any two sets $X$ and $Y$, the number $\left|M_{X \oplus Y}-\left(M_{X}+M_{Y}\right)\right|$ does not exceed the smallest of the ranges of sets $X$ and $Y$.

![](https://cdn.mathpix.com/cropped/2024_05_06_aa973e43eb29b804d001g-04.jpg?height=617&width=608&top_left_y=214&top_left_x=290)