Distance formula and rate of speed