10.8. On a plane, a square is drawn, with its sides horizontal and vertical. Several segments parallel to the sides are drawn inside it, such that no two segments lie on the same line and do not intersect at a point that is internal for both segments. It turns out that the segments divide the square into rectangles, and any vertical line intersecting the square and not containing segments of the partition intersects exactly $k$ rectangles of the partition, while any horizontal line intersecting the square and not containing segments of the partition intersects exactly $\ell$ rectangles. What could be the number of rectangles in the partition?
Answer. $k \ell$.

First solution. Take a horizontal line $h$ passing through the top side of the square, and move it downwards. Consider the moment when it passes through some segment $I$ of the partition (by the condition, such a segment is unique at this moment; let $a$ rectangles be adjacent to it from above and $b$ from below). The number of rectangles intersected by $h$ at this moment decreases by $a$ and increases by $b$; since it should not change, we get that $a=b$.

Now let's prove that the number of rectangles is $k \ell$, by induction on $k$. If $k=1$, the statement is obvious. Suppose now $k>1$. Consider all the rectangles of the partition adjacent to the bottom side of the square; there are $\ell$ of them, because a horizontal line passing close enough to this side intersects exactly them. Divide them into groups of consecutive rectangles of equal height (see Fig. 6). The upper boundary of each such group is one segment.

Consider one such group with the upper segment $I$. Note that the vertical segments bounding this group continue above $I$. Indeed, otherwise, say, the upper end of the left vertical segment $J$ lies on $I$; then to the right of $J$ there is one rectangle, and to the left - more than one (since $J$ is a boundary for the group). This is impossible.

Remove this group, and "extend" the rectangles lying above $I$ to the bottom side of the square. Since the same number of rectangles are adjacent to $I$ from above and below, any horizontal line will still intersect $\ell$ rectangles.

Perform this operation with each group (see Fig. 7). We will remove exactly $\ell$ rectangles; meanwhile, each vertical line will intersect one rectangle less than before, that is, $k-1$ rectangles. By the induction hypothesis, the total number of rectangles will become $(k-1) \ell$, which means that before the reconstruction it was $(k-1) \ell + \ell = k \ell$, as required.

![](https://cdn.mathpix.com/cropped/2024_05_06_8b5e293e563ce6c828ceg-4.jpg?height=183&width=315&top_left_y=840&top_left_x=236)

Fig. 6

![](https://cdn.mathpix.com/cropped/2024_05_06_8b5e293e563ce6c828ceg-4.jpg?height=183&width=327&top_left_y=840&top_left_x=593)

Fig. 7

![](https://cdn.mathpix.com/cropped/2024_05_06_8b5e293e563ce6c828ceg-4.jpg?height=196&width=324&top_left_y=838&top_left_x=949)

Fig. 8

Second solution. Consider any rectangle $P$ of the partition and a vertical line $v$ intersecting it (not containing a segment of the partition). Let $v$ intersect $i-1$ rectangles of the partition lying above $P$; in this case, we say that $P$ has a vertical number $i$ on the line $v$. Similarly, define the horizontal number of the rectangle $P$ on a horizontal line intersecting it.

Consider any horizontal segment $I$ of the partition and move the vertical line $v$ intersecting $I$ from left to right. Consider the moment when $v$ contains some segment of the partition (lying above or below $I$). As shown at the beginning of the previous solution, the same number of rectangles are adjacent to this segment from both sides. Therefore, the vertical number of any rectangle $P$ adjacent to $I$ does not change at this moment; moreover, the numbers of adjacent rectangles on the same side of $I$ are equal, and for those adjacent on different sides, it differs by 1. Thus, any rectangle $P$ has the same number on all vertical lines containing it. Similar statements are true for horizontal numbers.

Now fix a number $i$ and consider all rectangles $P_{1}, \ldots, P_{x}$ having a vertical number $i$ (let them be numbered according to the abscissas of their left boundaries from left to right). Move the vertical line $v$ from the left side of the square to the right. At each moment (except those when it contains a segment of the partition), $v$ intersects exactly one of the rectangles $P_{s}$; therefore, the right side of the next rectangle $P_{s+1}$ lies on the same line as the left side of the previous rectangle $P_{s}$ (see Fig. 8). Then these rectangles are adjacent to the same vertical segment of the partition from different sides, so the horizontal number of the rectangle $P_{s+1}$ is 1 more than the horizontal number of $P_{s}$. It is clear, finally, that the horizontal numbers of the rectangles $P_{1}$ and $P_{x}$ are 1 and $\ell$; therefore, $x=\ell$.

Thus, for each of the $k$ vertical numbers, there are exactly $\ell$ rectangles with that number; therefore, the total number of rectangles is $k \ell$.
![](https://cdn.mathpix.com/cropped/2024_05_06_8b5e293e563ce6c828ceg-5.jpg?height=216&width=474&top_left_y=1158&top_left_x=513)

Fig. 9

Remark. The conditions imposed on the segments of the partition are essential, as shown by the examples in Fig. 9.