Relative Motion of Two Trains Crossing Each Other
Problem
Two trains are moving in opposite directions on parallel tracks. Train A is 150 meters long and moving at a speed of 60 km/h. Train B is 100 meters long and moving at a speed of 40 km/h. How much total distance must they cover to completely pass through each other? Also, calculate the time taken for them to completely cross each other.
Explanation
We have two trains moving toward each other on parallel tracks.
- Train A: length , speed
- Train B: length , speed
They are moving in opposite directions, so for the crossing time, we use relative speed.
1. Total Distance to Completely Pass Each Other
To completely pass each other, the back end of one train must clear the front end of the other. That means the total distance that must be covered between their front ends is simply the sum of their lengths:
So the combined length to be cleared is 250 meters.
2. Relative Speed
They move in opposite directions, so their relative speed is the sum of their speeds:
We convert this to :
3. Time to Completely Cross Each Other
Time is distance divided by relative speed:
So:
- Total distance to be covered to completely pass:
- Time taken to completely cross: about
How the Visualization Works
This interactive visualization shows two colored trains moving in opposite directions on parallel tracks:
- The top track (cyan) is Train A (150 m).
- The bottom track (pink) is Train B (100 m).
- You can adjust:
- Their speeds (in km/h),
- Their lengths (in meters),
- And a time scale (to slow down or speed up the animation).
The visualization:
- Converts each train's speed from km/h to m/s.
- Uses the sum of their lengths to find the crossing distance.
- Uses the sum of speeds (relative speed) to compute the theoretical crossing time.
- Animates both trains starting just as their front ends meet.
- Draws a vertical reference line where they first meet.
- Continues the animation until the tail of one train has just cleared the other, marking that crossing is complete.
Under the hood, it repeatedly computes:
then uses the elapsed time to update each train's position so you can see how relative motion shortens the crossing time even though the total distance to be cleared is simply the sum of lengths.