# How to Calculate the Distance Between Two Coordinates

••• red and green discs in a red grid image by nebari from Fotolia.com
Print

Knowing how to calculate distance between two coordinates has many practical applications in science and construction. To find the distance between two points on a 2-dimensional grid, you need to know the x- and y-coordinates of each point. To find the distance between two points in 3-dimensional space, you need to know the z-coordinates of the points as well.

The distance formula is used to handle this job and is straightforward: Take the difference between the X-values and the difference between the Y-values, add the squares of these, and take the square root of the sum to find the straight-line distance, as in the distance between two points on Google maps over the ground rather than on a winding road or waterway.

## Distance in Two Dimensions

Calculate the positive difference between the x-coordinates and call this number X. The x-coordinates are the first numbers in each set of coordinates. For example, if the two points have coordinates (-3, 7) and (1, 2), then the difference between -3 and 1 is 4, and so X = 4.

Calculate the positive difference between the y-coordinates and call this number Y. The y-coordinates are the second numbers in each set of coordinates. For example, if the two points have coordinates (-3, 7) and (1, 2), then the difference between 7 and 2 is 5, and so Y = 5.

Use the formula D2 = X2 + Y2 to find the squared distance between two points. For example, if X = 4 and Y = 5, then D2 = 42 + 52 = 41. Thus, the square of the distance between the coordinates is 41.

Take the square root of D2 to find D, the actual distance between the two points. For example, if D2 = 41, then D = 6.403, and so the distance between (-3, 7) and (1, 2) is 6.403.

## Distance in Three Dimensions

Calculate the positive difference between the z-coordinates and call this number Z. The z-coordinates are the third numbers in each set of coordinates. For example, suppose two points in three-dimensional space have coordinates (-3, 7, 10) and (1, 2, 0). The difference between 10 and 0 is 10, and so Z = 10.

Use the formula D2 = X2 + Y2 + Z2 to find the squared distance between two points in three-dimensional space. For example, if X = 4, Y = 5, and Z = 10, then D2 = 42 + 52+ 102 = 141. Thus, the square of the distance between the coordinates is 141.

Take the square root of D2 to find D, the actual distance between the two points. For example, if D2 = 141, then D = 11.874, and so the distance between (-3, 7, 10) and (1, 2, 0) is 11.87.