4. Over the hypotenuse of the right triangle $A B C$ with legs $\overline{A C}=b$ and $\overline{B C}=a$, a square is constructed outside the triangle. What is the distance from $C$ to the center of the square?
Solution. From the vertex $A_{1}$ of the square $B A A_{1} B_{1}$, we drop a perpendicular to the line $A C$ and let $K$ be their intersection point. Then $\Varangle C A B=\measuredangle A A_{1} K$ (as angles with mutually perpendicular sides) and $\overline{A B}=\overline{A A_{1}}$. Therefore, triangles $A B C$ and $A K A_{1}$ are congruent. From this, $\overline{A K}=a$. Clearly, $\overline{B O}=\overline{A O}$. Let us note that

$$
\measuredangle C B O=\measuredangle C B A+45^{\circ}=\measuredangle K A A_{1}+45^{\circ}=\measuredangle K A O
$$

Therefore, triangles $C B O$ and $K A O$ are congruent. Furthermore,

$$
\begin{aligned}
90^{\circ} & =\measuredangle B O A=\measuredangle B O C+\measuredangle C O A \\
& =\measuredangle A O K+\measuredangle C O A \\
& =\measuredangle C O K
\end{aligned}
$$

Thus, triangle $C K O$ is an isosceles right triangle with legs $\overline{C O}=\overline{K O}$ and a right angle at vertex $O$. By the Pythagorean theorem, we get

![](https://cdn.mathpix.com/cropped/2024_06_05_2d390a2087465305abc8g-7.jpg?height=437&width=452&top_left_y=678&top_left_x=973)
$\overline{C O}=\frac{a+b}{\sqrt{2}}$.