A graph showing distance between two points in 2D
Dimensions
First point coordinates
x₁
y₁
Second point coordinates
x₂
y₂

Distance between any two points as a line.

Distance Formula

Distance in a 2D coordinate plane

If (x1, y1) are the coordinates of first point, (x2, y2) are the coordinates of second point, then the distance between two points can be calculated by the formula:

d = \sqrt{(x_{\tiny 2} – x_{\tiny 1})^2 + (y_{\tiny 2} – y_{\tiny 1})^2}

Distance in a 3D coordinate plane

If (x1, y1, z1) are the coordinates of first point in 3D, (x2, y2, z2) are the coordinates of second point in 3D, then the distance between two points in 3D can be calculated by the formula:

d = \sqrt{(x_{\tiny 2} – x_{\tiny 1})^2 + (y_{\tiny 2} – y_{\tiny 1})^2 + (z_{\tiny 2} – z_{\tiny 1})^2}

Calculate distance example

Calculate distance between two points with coordinates given as (2, 1) and (-5, 3).

Find the difference between coordinates:

x_{\tiny 2} – x_{\tiny 1} = -5 – 2 = -7

y_{\tiny 2} – y_{\tiny 1} = 3 – 1 = 2

Square the results and sum them up:

(-7)^2 + (2)^2 = 49 + 4 = 53

Find the square root and that\’s your result:

\sqrt{53} \approx 7.2801099

Page views: 2529