30.3. In a trapezoid with bases $x$ and 5, express the distance between the midpoints of the diagonals as a function of $x$.

$$
\text { (8-9 grades) }
$$
30.3. Let in trapezoid $ABCD$ points $K$ and $M$ be the midpoints of the lateral sides $AB$ and $CD$, respectively. Denote by $P$ and $Q$ the points of intersection of the midline $KM$ with the diagonals $AC$ and $BD$, respectively. Let $AD = x$, $BC = 5$, and consider two cases:

1) Suppose $x > 5$ (Fig. 26a). Then, taking into account that $KP = QM = 0.5 \cdot BC = 2.5$, we get:

$$
PQ = KM - KP - QM = \frac{x + 5}{2} - 5 = \frac{x - 5}{2}
$$

2) Suppose $x < 5$ (Fig. 26b). Since $KP = QM = 0.5 \cdot AD = 0.5x$, we have:

$$
PQ = KM - KP - QM = \frac{x + 5}{2} - x = \frac{5 - x}{2}
$$

![](https://cdn.mathpix.com/cropped/2024_05_21_f0d089db3d527e92a992g-41.jpg?height=314&width=830&top_left_y=241&top_left_x=610)

Fig. 26

Combining both cases and denoting $PQ$ by $y$, we get:

$$
y = \frac{|x - 5|}{2}
$$