
4. Given two odd positive integers $k$ and $n$. For each two positive integers $i, j$ satisfying $1 \leq i \leq k$ and $1 \leq j \leq n$ Martin wrote the fraction $i / j$ on the board. Determine the median of all these fractions, that is a real number $q$ such that if we order all the fractions on the board by their values from smallest to largest (fractions with the same value in any order), in the middle of this list will be a fraction with value $q$.

(Martin Melicher)


Solution. We show that the median has the value $q=\frac{k+1}{n+1}$. In the entire solution, $q$ denotes this number.

Since the given numbers $n$ and $k$ are odd, the fraction with value $q$ is actually written on the board-for example, it is a fraction $\frac{\frac{1}{2}(k+1)}{\frac{1}{2}(n+1)}$.

According to the comparison with the number $q$, we call a fraction $\triangleright$ small if its value is less than $q$,

$\triangleright$ mean if its value is equal to $q$,

$\triangleright$ large if its value is greater than $q$.

The number $k \cdot n$ of all fractions on the board is odd. To show that the middle fraction, when they are ordered by their values, has the value $q$, it is sufficient to prove that the number of small fractions is equal to the number of the large ones. (The latter will also mean that the number of mean fractions is odd, which again confirms their existence.)

We match the fractions written on the board-we couple each fraction $i / j$ with the fraction $i^{\prime} / j^{\prime}$ (and vice versa) if and only if $i^{\prime}=k+1-i$ and $j^{\prime}=n+1-j$, which can indeed be rewritten symmetrically as $i+i^{\prime}=k+1$ and $j+j^{\prime}=n+1$. Note that the inequalities $1 \leq i \leq k$ and $1 \leq j \leq n$ apparently hold if and only if $1 \leq i^{\prime} \leq k$ and $1 \leq j^{\prime} \leq n$.

It is obvious that only the fraction $\frac{\frac{1}{2}(k+1)}{\frac{1}{2}(n+1)}$ is „coupled" with itself and that all the other fractions are actually divided into pairs. If we show that every such pair either consists of one small and one large fraction, or of two mean fractions, we are done.

Thanks to the mentioned symmetry, it suffices to verify that a fraction $i^{\prime} / j^{\prime}$ is small if and only if the fraction $i / j$ is large. The verification is routine:

$$
\begin{aligned}
\frac{i^{\prime}}{j^{\prime}}(k+1) j \Leftrightarrow \frac{i}{j}>\frac{k+1}{n+1} .
\end{aligned}
$$

This completes the solution.

## REMARKS.
