Pythagorean Theorem (direct and inverse). $\quad]$ Inscribed angle subtended by the diameter  Right triangle $A B C\left(\angle A=90^{\circ}\right)$ and two squares $B E F C$ and $A M N C$ are arranged such that points $E$ and $A$ lie on opposite sides of line $B C$, and points $M$ and $B$ lie on opposite sides of line $A C$. Find the distance between the centers of the squares, if $A B=a, A C=b$.
Let $P$ and $Q$ be the centers of squares $B E F C$ and $A M N C$. We need to find $A P$.

First method. Points $A$ and $P$ lie on a circle with diameter $B C$. Let the radius of this circle be $R$. Since $B P = P C$, then

$\angle B A P = \angle C A P = 45^{\circ}, A P = 2 R \sin \left(\angle B + 45^{\circ}\right) = R \sqrt{2} \left(\frac{A C}{2 R} + \frac{A B}{2 R}\right) = \frac{a + b}{\sqrt{2}}$.

![](https://cdn.mathpix.com/cropped/2024_05_06_3ae27f1f0c68451d31a7g-03.jpg?height=826&width=692&top_left_y=216&top_left_x=683)

Second method. Let $X$ be the projection of point $F$ onto line $A C$, and $Y$ be the projection of point $E$ onto line $A B$, and $Z$ be the intersection of lines $F X$ and $E Y$. Then $A X Z Y$ is a square with side length $a + b$, and $A P$ is half of its diagonal.

Therefore, $A P = \frac{a + b}{\sqrt{2}}$.

$\angle P A Q = \angle P A C + \angle C A Q = 90^{\circ}$. By the Pythagorean theorem, $P Q^{2} = A Q^{2} + A P^{2} = \frac{b^{2}}{2} + \frac{b^{2}}{2} + a b + \frac{a^{2}}{2} = \frac{a^{2}}{2} + a b + b^{2}$.

## Answer

$\sqrt{\frac{a^{2}}{2} + a b + b^{2}}$