4. In a right-angled triangle $A B C\left(\angle C=90^{\circ}\right)$ with legs $\overline{C A}=21 \mathrm{~cm}$ and $\overline{C B}=28 \mathrm{~cm}$, a square is inscribed such that two of its sides lie on the legs, and the fourth vertex is on the hypotenuse. Calculate the lengths of the segments into which the vertex of the square divides the hypotenuse.
Solution. Let $C D E F, D \in C B, E \in B A$, $F \in C A$ be a square with side $x$ inscribed in $\triangle A B C$. Then

$$
P_{\triangle A B C}=P_{\triangle C D E F}+P_{\triangle D E B}+P_{\triangle F A E}
$$

where $\triangle D E B$ is a right-angled triangle with legs $x$ and 28-x, and $\triangle F A E$ is a right-angled

![](https://cdn.mathpix.com/cropped/2024_06_05_d112afdaa6f4bb49aaeeg-5.jpg?height=334&width=463&top_left_y=1722&top_left_x=999)
triangle with legs $x$ and 21-x. Therefore,

$$
\frac{21 \cdot 28}{2}=x^{2}+\frac{x(28-x)}{2}+\frac{x(21-x)}{2}
$$

from which $x=12 \mathrm{~cm}$. Then, by applying the Pythagorean theorem to $\triangle D E B$ and $\triangle F A E$, respectively, we get

$$
\begin{aligned}
& \overline{E A}=\sqrt{(21-x)^{2}+x^{2}}=\sqrt{225}=15 \mathrm{~cm} \\
& \overline{B E}=\sqrt{(28-x)^{2}+x^{2}}=\sqrt{400}=20 \mathrm{~cm}
\end{aligned}
$$