8. A moth made a hole in the carpet in the shape of a rectangle with sides 10 cm and 4 cm. Find the smallest size of a square patch that can cover this hole (the patch covers the hole if all points of the rectangle lie inside the square or on its boundary).
Answer: $7 \sqrt{2} \times 7 \sqrt{2}$ cm.

Solution. We need to find the smallest square that can contain a rectangle of $10 \times 4$ cm. If fewer than 4 vertices of the rectangle lie on the sides of the square, the size of the square can be reduced by rotating it relative to the rectangle. Let the vertices of the rectangle $A, B, C$, and $D$ lie on the sides of the square $E F G H$ (see figure).

Triangles $A E B$ and $B F C$ are similar with a ratio of $5: 2$. Let $A E=5 a, E B=5 b, B F=2 a, F C=2 b$. Similarly, triangles $B F C$ and $C G D$ are similar with a ratio of $2: 5$, so $C G=5 a$, $G D=5 b$. Therefore, the side of the square is, on one hand, $5 a+2 b$, and on the other hand, $2 a+5 b$. Thus, $a=b$. This means the acute angles of the triangles are each 45 degrees, from which we find $a=b=\sqrt{2}$. Therefore, the side of the square is $7 \sqrt{2}$ cm.