4. (GBR 3) We are given two mutually tangent circles in the plane, with radii $r_{1}, r_{2}$. A line intersects these circles in four points, determining three segments of equal length. Find this length as a function of $r_{1}$ and $r_{2}$ and the condition for the solvability of the problem.
4. In the coordinate system in which the $x$-axis passes through the centers of the circles and the $y$-axis is their common tangent, the circles have equations
$$
x^{2}+y^{2}+2 r_{1} x=0, \quad x^{2}+y^{2}-2 r_{2} x=0 .
$$

Let $p$ be the desired line with equation $y=a x+b$. The abscissas of points of intersection of $p$ with both circles satisfy one of
$$
\left(1+a^{2}\right) x^{2}+2\left(a b+r_{1}\right) x+b^{2}=0, \quad\left(1+a^{2}\right) x^{2}+2\left(a b-r_{2}\right) x+b^{2}=0 \text {. }
$$

Let us denote the lengths of the chords and their projections onto the $x$-axis by $d$ and $d_{1}$, respectively. From these equations it follows that
$$
d_{1}^{2}=\frac{4\left(a b+r_{1}\right)^{2}}{\left(1+a^{2}\right)^{2}}-\frac{4 b^{2}}{1+a^{2}}=\frac{4\left(a b-r_{2}\right)^{2}}{\left(1+a^{2}\right)^{2}}-\frac{4 b^{2}}{1+a^{2}} .
$$

Consider the point of intersection of $p$ with the $y$-axis. This point has equal powers with respect to both circles. Hence, if that point divides the segment determined on $p$ by the two circles on two segments of lengths $x$ and $y$, this power equals $x(x+d)=y(y+d)$, which implies $x=y=d / 2$. Thus each of the equations in (1) has two roots, one of which is thrice the other. This fact gives us $\left(a b+r_{1}\right)^{2}=4\left(1+a^{2}\right) b^{2} / 3$. From (1) and this we obtain
$$
\begin{array}{c}
a b=\frac{r_{2}-r_{1}}{2}, \quad 4 b^{2}+a^{2} b^{2}=3\left(\left(a b+r_{1}\right)^{2}-a^{2} b^{2}\right)=3 r_{1} r_{2} ; \\
a^{2}=\frac{4\left(r_{2}-r_{1}\right)^{2}}{14 r_{1} r_{2}-r_{1}^{2}-r_{2}^{2}}, \quad b^{2}=\frac{14 r_{1} r_{2}-r_{1}^{2}-r_{2}^{2}}{16} ; \\
d_{1}^{2}=\frac{\left(14 r_{1} r_{2}-r_{1}^{2}-r_{2}^{2}\right)^{2}}{36\left(r_{1}+r_{2}\right)^{2}} .
\end{array}
$$

Finally, since $d^{2}=d_{1}^{2}\left(1+a^{2}\right)$, we conclude that
$$
d^{2}=\frac{1}{12}\left(14 r_{1} r_{2}-r_{1}^{2}-r_{2}^{2}\right)
$$
and that the problem is solvable if and only if $7-4 \sqrt{3} \leq \frac{r_{1}}{r_{2}} \leq 7+4 \sqrt{3}$.