In quadrilateral $A B C D$, two non-intersecting circles are placed such that one of them touches sides $A B, B C$ and $C D$, while the other touches sides $A B, A D$ and $C D$. Line $M N$ intersects sides $A B$ and $C D$ at points $M$ and $N$ respectively and is tangent to both circles. Find the distance between the centers of the circles if the perimeter of quadrilateral $M B C N$ is $2 p, B C=a$ and the difference in the radii of the circles is $r$.

#
If $F$ and $Q$ are the points of tangency of the given circles with side $A B$, then $F Q=M N=p-$ $a$ (see problems $\underline{52724}$ and $\underline{53131})$.

## Solution

Let $O_{1}$ and $O_{2}$ be the centers of the given circles, and $F$ and $Q$ be the points of tangency with side $A B$. Then $F Q=M N=p-$ $a$ (see problems $\underline{52724}$ and $\underline{53131})$.

Drop a perpendicular $O_{1} K$ to $Q O_{2}$. Then $K O_{2}=\left|Q O_{2}-F O_{1}\right|=r, O_{1} O_{2}=\sqrt{r^{2}+(p-a)^{2}}$.

![](https://cdn.mathpix.com/cropped/2024_05_06_60e93adedf73503f106cg-52.jpg?height=323&width=526&top_left_y=685&top_left_x=777)

## Answer

$\sqrt{r^{2}+(p-a)^{2}}$.