let d is the driving speed then we have distance=30d
let t is the train speed then we have distance=20t so 30d=20t(1)
since the speed we have is mph we turn it to miles per minute so the 12 mph the train runs faster than
the car 12/60 = 1/5 = 0.2 miles per min (mpm)
we have according the story; t-d=0.2 mpm so t=0.2+d plugging this value to (1) we get 30d=20(0.2+d)
deviding by 10 both sides we get 3d=2(0.2+d) -->>> 3d=0.4+2d , 3d-2d=0.4 so d=0.4 mpm
and because t-d=0.2 we get t=0.2+d t=0.2 + 0.4 = 0.6 mph and plugging these values to (1) we get
30(0.4)=20(0.6) = 12 miles that is the distance