On this page
It is a classic relative-speed question in school physics and aptitude practice: two trains of known lengths run on parallel tracks at known speeds, and you have to find how long they take to pass each other. Every version uses one rule. Once you see why it works, you won't need separate formulas for opposite and same directions.
How do you find the time for two trains to pass each other?
You need three things: the two lengths, the two speeds and their directions.
Convert every speed to m/s by multiplying km/h by 5/18.
Find the relative speed: add the speeds if the trains move in opposite directions, and subtract the smaller from the larger if they move the same way.
Add the two lengths.
Divide: time = (length A + length B) ÷ relative speed.
Step 2 comes from the rule for relative motion. As OpenStax University Physics, section 4.5 puts it, "The velocity of a particle relative to S is equal to its velocity relative to S′ plus the velocity of S′ relative to S." On a straight track, this means train A's velocity as seen from train B is v(A) − v(B), with a sign for each direction. Opposite signs turn the subtraction into a sum.
Why do you add the two lengths?
Most kinematics treats moving objects as points. The NCERT Class 11 Physics chapter Motion in a Straight Line says "This approximation is valid so far as the size of the object is much smaller than the distance it moves in a reasonable duration of time." Its first exercise asks whether a railway carriage moving between two stations can be treated as a point. When two trains pass each other, the distance involved is about the length of the trains themselves, so they cannot be treated as points.
Imagine you are sitting in train B and treat it as standing still. Train A now slides past at the relative speed. Passing begins when the leading end of A draws level with the near end of B. It ends when the trailing end of A clears the far end of B. In that time, the leading end of A travels the whole of B and then the whole of A. That is the sum of the lengths, which the diagram above draws to scale.
Worked example: trains moving in opposite directions
Train A is 200 m long and runs at 54 km/h. Train B is 160 m long and runs at 72 km/h in the opposite direction.
Speeds: 54 × 5/18 = 15 m/s, and 72 × 5/18 = 20 m/s.
Relative speed: 15 + 20 = 35 m/s.
Distance: 200 + 160 = 360 m.
Time: 360 ÷ 35 ≈ 10.3 s.
Worked example: one train overtaking the other
Use the same trains, but now both run the same way, with B overtaking A.
Relative speed: 20 − 15 = 5 m/s.
Distance: still 360 m, because the lengths have not changed.
Time: 360 ÷ 5 = 72 s.
The same pair of trains takes seven times longer to pass when overtaking, because 35 ÷ 5 = 7.
What changes for a pole, a platform or a passenger?
Set the length or speed of the second object to whatever it really is:
A pole or a person standing on the ground: no length and no speed, so time = train length ÷ train speed.
A platform, bridge or tunnel: it has length but no speed, so time = (train length + platform length) ÷ train speed.
A passenger in train A watching B go past the window: the passenger counts as a point, so only B's length counts. With the numbers above, that is 160 ÷ 35 ≈ 4.6 s head-on and 160 ÷ 5 = 32 s when overtaking.
The same idea, with zero lengths, solves meeting problems such as two people walking towards each other. With a head start added, it becomes chase and overtaking problems. When the paths are not parallel, you need relative velocity in two dimensions and closest approach.
Where do students lose marks?
Before you circle an answer, check:
Did you convert km/h to m/s before mixing speeds with lengths in metres?
Did you add the speeds for opposite directions and subtract them for the same direction?
Did you use both lengths for train-past-train, and one length for a pole or a passenger?
If you keep getting the sign of the relative speed wrong, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than just printing an answer. To revise relative velocity from the start, the Fermi Concept Library gives each physics concept its own lesson and shows where it fits on the map.
Try the overtaking example again with B at 90 km/h and see whether your answer passes the sense check.



