Task B-2.4. (20 points) Points $A, B$ and $C$ lie on the same line and $B$ is between $A$ and $C$. On the same side of the line $A C$, three semicircles with diameters $|A B|=2 R,|B C|=2 r$ and $|A C|$ are constructed. Determine the radius of the circle that is tangent to all three semicircles.
Solution. Let $S$ be the center of the circle with radius $x$ that touches the three semicircles, and let $d$ be its distance from the line $A C$.

Let $S_{1}, S_{2}, S_{3}$ be the midpoints of the segments $\overline{A B}, \overline{B C}, \overline{A C}$, respectively.

From the diagram, we get:

$$
\begin{aligned}
\left|S_{1} S_{3}\right| & =\left|A S_{3}\right|-\left|A S_{1}\right|=(R+r)-R=r \\
\left|S_{2} S_{3}\right| & =\left|C S_{3}\right|-\left|C S_{2}\right|=(R+r)-r=R \\
\left|S_{1} S\right| & =R+x \\
\left|S_{2} S\right| & =r+x \\
\left|S_{3} S\right| & =\left|S_{3} M\right|-|S M|=R+r-x
\end{aligned}
$$

![](https://cdn.mathpix.com/cropped/2024_05_30_978576e245d98ac92b08g-12.jpg?height=403&width=730&top_left_y=467&top_left_x=548)

We will express the areas of triangles $S_{1} S S_{3}$ and $S_{1} S S_{2}$ using Heron's formula and the base and height to it:

$$
\begin{aligned}
\sqrt{(R+r) R(r-x) x} & =\frac{1}{2} r d \\
\sqrt{(R+r+x) R r x} & =\frac{1}{2}(R+r) d
\end{aligned}
$$

By squaring these equations and dividing one by the other, after simplification, we get

$$
x=\frac{\operatorname{Rr}(R+r)}{R^{2}+R r+r^{2}}
$$