Two trains X and Y (80 km from each other) are running towards each other on the same track with a speed of 40km/hr. A bird starts from the train X and travels towards train Y with constant speed of 100km/hr. Once it reaches train Y, it turns and starts moving toward train X. It does this till the two trains collides with each other. Find the total distance traveled by the bird?

# Puzzles asked in interviews

for solution consider the below link

**Harsha_1997**#3

Velocity of approach for the two trains = (40 + 40) km/hr

Total time the trains will take to collide = 80km/80km/hr = 1 hour

Total distance travelled by the bird = 100km/hr * 1hr = 100 km.

**satish**#4

Now, the trains take one hour to collide (their relative speed is 100 km/h and they are 100 km apart initially). Since the fly is traveling at 75 km/h and flies continuously until it is squashed (which it is to be supposed occurs a split second before the two oncoming trains squash one another), it must therefore travel 75 km in the hourâ€™s time. The position x(t) of the fly at time t is plotted above.

However, a brute force method instead solves for the position of the fly along each traversal between the trains. For example, the fly reaches the second train when

75t=100-50t,

(1)

or t_1=4/5 h, at which point it has traveled a distance d_1=75t_1=60 km. It then turns around and reaches the first train again when

60-75t=40+50t,

(2)

or t_2=4/25. Continuing, the total distance traveled by the fly is given by summing the series

75sum_(n=1)^infty4/(5^n)=75.