5. A person is walking parallel to a railway track at a constant speed. A train also passes by him at a constant speed. The person noticed that depending on the direction of the train, it passes by him either in $t_{1}=1$ minute or in $t_{2}=2$ minutes. Determine how long it would take the person to walk from one end of the train to the other.

## $(15$ points)
Answer: 4 min

Solution. When the train and the person are moving towards each other:

$l=\left(v_{n}+v_{u}\right) \cdot t_{1}$ (3 points), where $l$ - the length of the train, $v_{n}$ - its speed, $v_{u}$ - the speed of the person. If the directions of the train and the person are the same, then:

$l=\left(v_{n}-v_{u}\right) \cdot t_{2} \quad\left(3\right.$ points). In the situation where the person is walking on the train: $l=v_{u} \cdot t_{3}$. (3 points). Solving this system of equations, we get the final answer:

$t_{3}=\frac{2 t_{1} t_{2}}{t_{2}-t_{1}}=\frac{2 \cdot 1 \cdot 2}{2-1}=4$ minutes (6 points).