Because d = r*t, and the times are the same in the problem, let's solve for t:
Divide each side by r, and you get:
t = d/r
Now, we know the times are the same, so the equation is:
tA = tB
Unfortunately, we don't have actual numbers for the times, but we do have distances and rates, and we know that time = distance/rate from above. So, let's make the equation:
dA/rA = dB/rB
From the problem, the variables are:
dA = 160
dB = 120
rA = rB+20
rB = ?
Plug those into your equation:
160/(rB+20) = 120/rB
Now there's only one variable, so solve for the rate of train B:
160rB = 120rB + 2400
40rB = 2400
rB = 60 mph
We know from above that rA = rB + 20, so rA = 80 mph
Always set up the variables to figure out what you're given in the problem, then adjust the distance formula (d = r*t) from there so it will work for your problem!
To be perfectly honest, the second one has me stumped! It seems like other people have given you answers, though, so I hope they're right. Good luck!