Let the speeds of both trains be ‘x’ and ‘y’.
When running in same directions, their relative velocity = x – y
Total distance to cross each other = 100 + 80 = 180
speed = distance/time = x – y = 180/18 = 10 ? they take 18 s to cross here
⇒ x – y = 10 ------Equation (1)
When running in opposite direction, relative velocity = x + y
speed = distance/time = x + y = 180/9 = 20 ? they take 9 s to cross here
⇒ x + y = 20 ------Equation (2)
Adding (1) and (2) = 2x = 30 ⇒ x = 15 m/s
⇒ Equation (1) ⇒ 15 – y = 10 ⇒ y = 15 – 10 = 5 m/s
∴ x = 15 m/s and y = 5 m/s
∴ Speed of faster train = x = 15 m/s