Let after t hours the distances D1 traveled by car A
=> D1 = 30 t
Car B starts at 10 am and will, therefore, have spent one hour less than car A when it passes it.
After (t - 1) hours, distance D2 traveled by car B
=> D2 = 40 (t - 1)
When car B passes car A, they are at the same distance from the starting point and therefore D1 = D2
=> 30 t = 40 (t - 1)
Solve the equation for t,
=> 30 t = 40t - 40
=> 10 t = 40
=> t = 4
=> Car B passes car A at = 9 + 4 = 13 pm.