There are two trains exactly 60 miles apart on the same railway track. on the front of the engine of one of the trains is a fly.
Both trains start simultaneously, heading towards each other at exactly 30 miles per hour. Startled by the train moving, the fly starts flying along the track towards the other train at exactly 40 miles per hour.
[Please note that these are special, theoretical "puzzle" trains and fly, and they will instantly start travelling at the stated speed, with no need for acceleration!]
After a while the fly reaches the other train, hits the front of it, bounces back and starts flying towards the first train at 40 miles per hour.
This process continues, with the fly traversing the ever-decreasing distance between the two trains, shuttling back and forth at 40 miles per hour.
Eventually the two trains collide, crushing the fly. And probably incurring other damage as well, but these are special, theoretical "puzzle" trains and no one, apart from the fly, is harmed.
What is the total distance covered by the fly, adding up all the ever-shortening flights between the trains?
The two trains are 60 miles apart, and as both travel at 30 miles per hour, the closing speed is 60 miles per hour. This means that it takes one hour for them to meet and crash into each other.
In one hour the fly, which is travelling at 40 miles per hour, will cover 40 miles.
The answer is 40 miles, with no need to try to calculate the sum of every decreasing distances!