A Baranya IC overtakes a freight train traveling on a parallel track, then they pass each other in the opposite direction. The ratio of the IC's speed to the freight train's speed is the same as the ratio of the time it takes to overtake to the time it takes to pass each other. How many times faster is the IC than the freight train, if both trains maintain a constant speed?
Solution. Let the speed of the IC be $u \mathrm{~km} / \mathrm{h}$ and the speed of the freight train be $v \mathrm{~km} / \mathrm{h}$. Let the length of the IC be $x \mathrm{~km}$, and the length of the freight train be $y \mathrm{~km}$. When the IC overtakes the freight train, in the reference frame fixed to the freight train, the distance covered during the overtaking is $x+y$, and the speed is $u-v$. When the IC meets the freight train head-on, in the reference frame fixed to the freight train, the distance covered during the passing is $x+y$, and the speed is $u+v$. Thus, the time for overtaking is $\frac{x+y}{u-v}$, and the time for passing head-on is $\frac{x+y}{u+v}$. Therefore:

$$
\begin{gathered}
\frac{u}{v}=\frac{\frac{x+y}{u-v}}{\frac{x+y}{u+v}}, \quad \frac{u}{v}=\frac{u+v}{u-v}, \quad u^{2}-2 u v-v^{2}=0 \\
\left(\frac{u}{v}\right)^{2}-2 \cdot\left(\frac{u}{v}\right)-1=0
\end{gathered}
$$

The solutions to this are: $1-\sqrt{2}$ and $1+\sqrt{2}$. The first number is negative, so it is not a valid solution.

Therefore, the ratio of the speed of the IC to the speed of the freight train is: $1+\sqrt{2}$.