10.005. A square is inscribed in a right triangle with legs $a$ and $b$, sharing a right angle with the triangle. Find the perimeter of the square.
## Solution.

Let the side of the square be denoted by $x$ (Fig. 10.5). Since $\triangle A C B \sim \triangle F E B$, we have $\frac{a}{x}=\frac{b}{b-x}$. Therefore,

$$
x=\frac{a b}{a+b}, P=4 x=\frac{4 a b}{a+b}
$$

Answer: $\frac{4 a b}{a+b}$.