Solution: Let ‘X’ and ‘Y’ be the two cars starting from places ‘A’ and ‘B’.
Speed of car ‘X’ = x km/hr,
and Speed of car ‘Y’ = y km/hr
Case 1. When two cars move in the same direction:
Suppose two cars meet at a point P, then
Distance travelled by the car A in 6 hrs is AP = Speed x Time
=> (x km/hr) x (6hr)
=> 6x km ………..(1)
Distance travelled by the car Y in 6 hours is BP = (y km/hr) x (6h)
=> 6y km ………….(2)
Distance between the two places A and B = Distance travelled by the car X – Distance travelled by the car Y
=> AB = AP – BP
using equations (1) and (2), we get
=> 120 = 6x – 6y
=> x-y=20 ………..(3)
Case 2. When two cars move in the opposite directions (towards each other):

Suppose two cars meet at a point Q, then
Distance travelled by the car ‘X’ in 6/5 hours is AQ = (6/5 x km/hr) …….. (4)
Distance travelled by the car ‘Y’ in 6/5 hours is BQ = (6/5 y km/hr) ………(5)
Distance between two places A and B = Distance travelled by the car X + Distance travelled by the car Y
=> AB = AQ + BQ
=> 6/5 x + 6/5 y = 120
=> 6x + 6y = 600
=> x + y = 100 …….(6)
On adding eq.(3) and (6), we get
=> 2x = 120 and x = 60
=> x = 60 and y = 40. Hence, the speed of the two cars are 60 km/hr and 40 km/hr respectively