This calculator computes the distance between two points in two or three dimensions. It also finds the distance between two places on the world map, which are determined by their longitude and latitude. The calculator shows formulas and all steps.
Definition:
The distance between two points in the coordinate plane or space is the line segment length that connects these two points.
Distance in the Coordinate Plane
To find the distance between points A (X1, y1) and B (x2, y2) in a plane, we usually use the Distance formula:
$$ d(A,B) = \sqrt{(x_B - x_A)^2 + (y_B-y_A)^2} $$Example:
Find distance between points A(3, -4) and B(-1, 3)
Solution:
First we need to identify constant x1, y1, x2 and y2: x1 = 3, y1 = -4, x2 = -1 y2 = 3. Now we can apply above formula:
d(A,B) = √[(x2 - x1)^2 + (y2-y1)^2]
d(A,B) = √[(-1-3)^2 + (3-(-4))^2
d(A,B) = √[(-4)^2 + 7^2]
d(A,B) = √[16+49]
d(A,B) = √65
Distance in the Euclidean Space
The distance between points A (X1, y1, z1) and B (x2, y2, z2) in spcace is given by the formula:
$$ d(A,B) = \sqrt{(x_B - x_A)^2 + (y_B-y_A)^2 + (z_B-z_A)^2} $$Example:
Find distance between A(2, -1, 5) and B(3, 5, 2)
Solution:
In this example the constants are x1 = 2, y1 = -1, z1 = 5, x2 = 3, y2 = 5, z2 = 2. Now we can apply above formula:
d(A,B) = √[(x2 - x1)^2 + (y2-y1)^2 + (z2-z1)^2]
d(A,B) = √[(3-2)^2 + (5-(-1))^2 + (2-5)^2
d(A,B) = √[(1)^2 + 6^2 + (-3)^2]
d(A,B) = √[1 + 36 + 9]
d(A,B) = √46
Distance between points on sphere
The distance formula for two points on the Earth’s surface is:
d(A,B) = arccos[ sin(lat1) * sin(lat2) +cos(lat1) * cos(lat2) * cos(lon2 - lon1)] ∗6371
where lat1, lon1, lat2, and lon2 are their latitude and longitude coordinates.
Example:
Find distance between A(14.213, -38.481) and B(-2.13, 0.829)
Solution:
In this example the latitudes and longitudes: lat1 = 14.213, lon1 = -38.481, lat2 = -2.13, lon2 = 0.829. After substituting into the formula, we get:
d(A,B) = arccos[ sin(lat1) * sin(lat2) +cos(lat1) * cos(lat2) * cos(lon2 - lon1)] ∗6371
d(A,B) = arccos[ sin(14.213) * sin(-2.13) + cos(14.213) * cos(-2.13) * cos(0.829 + 38.481 )] ∗6371
d(A,B) = arccos[ - 0.2455 * 0.0371 + 0.9696 * 0.9993 * 0.7737] ∗6371
d(A,B) = arccos[ - 0.00910 + 0.7496]
d(A,B) = arccos[ 0.7405 ] ∗6371
d(A,B) = 5867.4