I just got the proof, thought i'd share, z/x is speed for faster train and z/y is for regular and their directions are opposite.
Relative speed -
1) If A with speed x km/hr goes in one direction and B with speed y km/hr goes in the same direction as A then
relative speed - x-y km/hr (x>y)
2) If A with speed x km/hr goes in one direction and B with speed y km/hr goes in the opposite direction i.e. towards A then
relative speed - x+y km/hr
Example -
For 2) A and B in opposite direction. Distance between A and B = D. Refer fig.
Assume distance covered by A = d km then distance covered by B when A and B meet = (D-d) km
S(A) = d/t; S(B)=D-d/t
S(A) = x = d/t; S(B) = y = (D-d)/t
time taken by both is same, therefore equate for t.
d/x = (D-d)/y
yd = x(D-d)
yd = xD-xd
yd+xd = xD
d(y+x) = xD
d = xD/(y+x)
time t = d/S(A) = xD/(y+x)/x = D(y+x)
Therefore Relative speed = (x+y) = Distance/Time = D/t
For 1) A and B in same direction. Refer fig.
Suppose train A starts from the point show and B starts from its point at the same time and B is D km (this distance will be know in the problem) ahead of A. Assume that A and B meet at certain point d km from starting point of B. Then total distance to be covered by A is D + d
Distance to be covered by A in time 't' , in this time frame 't' B has moved d km from its point. Hence time taken by A and B is same in order to meet at some point.
x = D+d/t ;
y = d/t
As time 't' taken by both A & B is same equate t.
(D+d)/x = d/y
y(D+d) = xd
yD = d(x-y) (obviously x has to be > y in order to catch up with B)
d = yD/(x-y)
Time t = d/y = yD/y(x-y) = D/(x-y).
Therefore relative speed = (x-y) = Distance/time = D/t
Hope is the dream of a man awake