Car X traveled 3d distance in t time. Car Y traveled 2d distance in t time. Therefore, the speed of car X, is 3d/t, the speed of car Y, is 2d/t. Since speed is the distance taken in a given time.
In figure-2, they are at the same place, we are asked to find car Y's position when car X is at line-A. We can calculate the time car X needs to travel to there. Let's say that car X reaches line-A in t' time.
[tex]V_x .t' = 3d\\ \frac{3d}{t} .t' = 3d\\ t'=t[/tex]
Okay, it takes t time for car X to reach line-A. Let's see how far does car Y goes.
[tex]V_y.t = \frac{2d}{t} .t = 2d[/tex]
We found that car Y travels 2d distance. So, when car X reaches line-A, car Y is just a d distance behind car X.