Answer :
Assuming both cars start at the same position, in the first 3 hours the first car covers a distance of
(40 mi/h) (3 h) = 120 mi
Take the 3 hour mark to be the origin, so that the first car's position after t hours is
120 mi + (40 mi/h) t
while the second car's position is
(55 mi/h) t
The second car catches up to the first when their positions are equal:
120 mi + (40 mi/h) t = (55 mi/h) t
120 mi = (15 mi/h) t
t = (120 mi) / (15 mi/h)
t = 8 h