please explain how you got the answer

car A - 20m/s
car B - 30m/s

Assume that both cars are 5m long. Suppose that car B is 20m behind car A is attempting to overtake car A. How long will it take for car B to arrive 10m ahead of car A?

The length of the cars does not matter, if you define distance behind and distance ahead as the distance between the front ends. You need to clarify the definition.

In order for car B to advance from 20 m behind to 10 m ahead, it must advance 30 m relative to car A. Since the relative speed is 10 m/s, that will require
T = 30 m/ 10 m/s = 3 seconds

01

To find out how long it will take for car B to arrive 10m ahead of car A, we need to calculate the time it takes for car B to cover a distance of 30m (20m behind car A plus the additional 10m ahead of car A).

First, let's find out how much time it will take for car A to cover 10m. Since the speed of car A is 20m/s and the distance to be covered is 10m, we can use the formula:

time = distance / speed

time = 10m / 20m/s

time = 0.5s

Now, the time it takes for car B to cover 30m is the time it takes for car B to overtake car A and travel an additional 10m. Since the speed of car B is 30m/s, we can use the same formula to calculate the time:

time = distance / speed

time = 30m / 30m/s

time = 1s

Therefore, it will take car B 1 second to arrive 10m ahead of car A.