1. A rectangle of size $m \times n (m > n)$, consisting of $1 \times 1$ squares, is laid out with matches (Fig. 22.54a). a) How many matches were used for its construction, assuming the length of a match is 1? b) How many possible rectangles, composed of these matches, can be counted in this figure? c) How many possible squares, composed of these matches, can be counted in this figure?

![](https://cdn.mathpix.com/cropped/2024_05_06_f022ee2a6cd23217498fg-1.jpg?height=417&width=689&top_left_y=817&top_left_x=338)
Solution. a) Let $\mathrm{m}$ be the length of the rectangle, and $\mathrm{n}$ be the height. Then, vertically, there will be $\mathrm{n} \cdot(\mathrm{m}+1)$ matches, and horizontally, there will be $-\mathrm{m} \cdot(\mathrm{n}+1)$ matches. Therefore, to construct such a rectangle, it will require $\mathrm{n}(\mathrm{m}+1)+\mathrm{m}(\mathrm{n}+1)=2 \mathrm{mn}+\mathrm{m}+\mathrm{n}$ matches.

b) Along one vertical side, there will be: $\mathrm{n}$ rectangles of size $1 \times 1 ; \mathrm{n}-1$ rectangles of size $1 \times 2 ; \mathrm{n}-2$ rectangles of size $1 \times 3 ; \ldots ; 2$ rectangles of size $1 \times(n-1) ; 1$ rectangle of size $1 \times n$; i.e., a total of $1+2+3+\ldots+(n-1)+n=n(n+1) / 2$ rectangles. Similarly, along one horizontal side, there will be $\mathrm{m}(\mathrm{m}+1) / 2$ rectangles. Therefore, a total of $\mathrm{m}(\mathrm{m}+1) \mathrm{n}(\mathrm{n}+1) / 4$ rectangles can be counted, formed from the given matches.

c) It is not difficult to see that a total of:

$\mathrm{mn}$ squares of size $1 \times 1$,

$(m-1)(n-1)$ squares of size $2 \times 2$,

$(\mathrm{m}-2)(\mathrm{n}-2)$ squares of size $3 \times 3$,

$(\mathrm{m}-(\mathrm{n}-2))(\mathrm{n}-(\mathrm{n}-2))$ squares of size $(\mathrm{n}-1) \times(\mathrm{n}-1)$,

$(m-(n-1))(n-(n-1))$ squares of size $n \times n$,

thus, in total, $\mathrm{mn}+(m-1)(n-1)+(m-2)(n-2)+\ldots+(m-(n-2))(n-(n-2))+(m-(n-1))(n-(n-1))=m n+(m n-m-n+1)+(m n-2 m-2 n+4)+(m n-3 m-3 n+9)+\ldots+\left(m n-(n-2) m-(n-2) n+(n-2)^{2}\right)$ $+\left(m n-(n-1) m-(n-1) n+(n-1)^{2}\right)=n m n-m(1+2+3+\ldots+(n-1))+n(1+2+3+\ldots+(n-1))+1^{2}+2^{2}+3^{2}+\ldots+(n-1)^{2}$

$\left.=n^{2} m-(m+n)((n-1) n / 2)+(n-1) n(2 n+1) / 6=n^{2} m-((n-1) n / 2) \cdot(3 m+3 n-2 n+1) / 3\right)=\left(6 m n^{2}-(n-\right.$ 1) $n(3 m+n+1)) / 6=\left(6 m n^{2}-3 m n^{2}-n^{2}+3 m n+n-n^{3}+n^{2}\right) / 6=\left(3 m n^{2}+3 m n-n^{3}+n\right) / 6=\left(3 m n(n+1)-n\left(n^{2}-1\right)\right) / 6=$ $\mathrm{n}(\mathrm{n}+1)(3 \mathrm{~m}-\mathrm{n}+1) / 6$ squares

Answer: a) $2 \mathrm{mn}+\mathrm{m}+\mathrm{n}$ matches; b) $\mathrm{m}(\mathrm{m}+1) \mathrm{n}(\mathrm{n}+1) / 4$; c) $n(n+1)(3 m-n+1) / 6$.