# To be defined / distance calculator related

Calculating Distances

There are multiple ways to approach the problem of calculating a distance. For example, you would take a different approach to calculating driving distance than you would take if you wanted to calculate the shortest direct distance between two points. This is because you cannot necessarily drive directly between the starting point and the ending point you have in mind; highways and roads meander around obstacles such as buildings and bodies of water that a car cannot drive overtop of. So the driving distance between two points is typically longer than the direct distance between those points.

If you have complex distance computations to make, a distance calculator can help you make the appropriate calculations. There are different types of distance calculators including three-dimensional distance calculators and driving distance calculators. You should choose the type of distance calculator that is best suited to the type of distance problem you are trying to solve.

If you need to calculate distance manually, one general formula for making the calculation is as follows:

Distance equals the rate of speed multiplied by the measure of allocated time.

You might need to change units to make accurate calculations. For example, if your rate of speed is calculated in miles per hour, but the allocated time is only minutes long, it would be helpful to calculate your rate of speed in miles per minute instead of miles per hour.

If you’re calculating the speed of sound, this formula can be rearranged and stated in a different way, as follows:

The speed is equal to the distance divided by the time.

There’s another useful distance formula for calculating the measurement between a couple of points on the coordinate plane. Let’s define the first point as A(X1, Y1) and the second point as B(X2, Y2). If you draw a straight line between these points, think of that straight line as being the hypotenuse on a right triangle with the designation d(A,B). One leg of the triangle would have a measurement of y2-y1, and the other would have a measurement of x2-x1. The resulting formula is as follows:

d(A,B) is equal to the square root of (x2-x1) squared + (y2-y1) squared.

If you arrange these points in the form of a right triangle, you can see a relationship to the Pythagorean theorem.

There is much more to be learned about calculating distance, but these are some of the most important considerations to keep in mind as you determine the approach you should take given the known variables you’re working with.