Let the speed of the cars be x km/hr and y km/hr.
Distance between 2 cars is 200 km.
When the cars travel in the same direction,
Distnace traveled by 1st car in 4 hrs is 4x km [distance = speed × time]
Distnace traveled by 2nd car in 4 hrs is 4y km
∴4x−4y=200
⇒x−y=50……(i)
When the cars travel in the same direction,
Distnace traveled by 1st car in 1 hr is x km [distance = speed × time]
Distance traveled by 2nd car in 1 hr is y km
∴x+y=200……(ii)
Solving equation (i) and (ii),
x=50+y [From (i)]
Substituting value of x in (ii)
x+y=200
50+y+y=200
50+2y=200⇒y=75
Now, x=50+y
x=50+75⇒x=125
∴x=125,y=75