# What's the Distance Formula?

••• forrest9/iStock/GettyImages
Print

Distance is an important concept both in mathematics and the real world. Of course, measuring real-world distances is typically easier than distances in math; all that you have to do is use a tool like a ruler or odometer to get the actual distance measurement. Given that scales can vary, however, the same technique won't work when measuring distances mathematically. The formula used to calculate distance depends on whether you're measuring distance over time or a distance between two points on a plane.

## Distance Over Time

If you need to calculate the distance between two locations while traveling, this means you're calculating distance over time. The calculation assumes that you're moving at a constant rate and that your movement will occur over a set period of time. If you know these two elements, the distance traveled over that period of time is simply a matter of multiplying the two.

## Distance Over Time Formula

The formula to calculate distance over a period of time is :

\text{distance}=\text{rate}\times\text{time}

To give an example of this, if you're traveling 60 miles per hour (mph) and drive for two and a half hours (2.5 h), you can calculate the distance traveled as:

\text{distance}=60\times25=150\text{ miles}

This gives a total distance of 150 miles (since miles per hour is essentially a fraction of m/h and hours can be shown as a fraction of h/1, the two time factors cancel out and leave only miles). You can also use this formula to calculate rate or time as needed, transforming it to:

\text{rate}=\frac{\text{distance}}{\text{time}}\\\text{or}\\\text{time}=\frac{\text{distance}}{\text{rate}}

for whichever calculation you need.

## Distance Between Points

If you're working on a two-dimensional graph, the distance formula is a bit different. Since neither time nor rate are involved in static graphs, you'll instead need to calculate the distance between two points based on their x and y coordinates. The formula here is actually based on the Pythagorean Theorem, as you're essentially calculating one side of a triangle based on its two corner points. You'll take the differences between the x coordinates and between the y coordinates, then square those results and add them. The square root of your final result is the distance between those points.

## Distance Between Points Formula

The formula for this calculation is:

\text{distance}=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}

where the first point is represented by (x1,y1), and the second point is represented by (x2,y2). To give an example, say you're trying to find the distance between the points (1,3) and (4,4). Putting those numbers in the formula, you have:

\text{distance}=\sqrt{(4-1)^2+(4-1)^2}=\sqrt{3^2+1^2}=\sqrt{9+1}=\sqrt{10}

The distance ends up being √10, which works out to around 3.16.