Question 358071
It depends on the starting position.
----------
If you mean from the time the faster train's front is even with the rear of the slower train, until the fronts and backs are reversed, then:
The relative speed is 20 mph (60 - 40)
The total distance is 1 mile, from the fast train being even with the rear of the slow train to vice versa
--------
1 mile/20 mph = 1/20 hour = 3 minutes.