4. Rectangle $A B C D$ is intersected by $m$ lines parallel to side $A B$ and $m$ lines parallel to side $B C$. Find the number of resulting rectangles.
Solution. Horizontal lines together with $A B$ and $C D$ have $m+2$, the same as vertical lines. Any two horizontal lines define a rectangle, so the number of such obtained rectangles is ( $\left.\begin{array}{c}m+2 \\ 2\end{array}\right)$.

The number of rectangles defined by the vertical lines is also ( $\left.\begin{array}{c}m+2 \\ 2\end{array}\right)$.

![](https://cdn.mathpix.com/cropped/2024_06_05_ae7d00f0d51ae2d35791g-11.jpg?height=339&width=510&top_left_y=633&top_left_x=973)

Thus, the total number of rectangles is

$$
\binom{m+2}{2}^{2}=\frac{(m+2)^{2}(m+1)^{2}}{4}
$$