Their combined speed is 90+70=160km/hr. If train Q is stationary and train P is moving at 160km/hr, train P has to travel a distance of 110m, so that the front of train P reaches the back of train Q, but the back of train P has to travel a further 90m, the length of train P, to reach the back of train Q. So in all, train P has to travel 110+90=200m to pass train Q. 160km/hr is 160000m/hr=160000/3600m/sec=1600/36=400/9m/sec. The time to travel 200m=200/(400/9)=9/2=4.5sec. Speed is relative, so this is equivalent to the trains moving at their given speeds.