MathorynMathematical Formula Database

Analytic Geometry

Distance Formula in 3D

The distance between two points in space extends the plane distance formula with a third coordinate. It is used in 3D geometry, computer graphics and for lengths of vectors between points.

d=(x2−x1)2+(y2−y1)2+(z2−z1)2d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}
LaTeXd=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}

Variables

(x1,y1,z1), (x2,y2,z2)(x_1,y_1,z_1),\ (x_2,y_2,z_2)
the two points
dd
distance

Example

Find the distance between (1,2,3)(1,2,3) and (4,6,15)(4,6,15).

  1. Differences: 3, 4, 123,\ 4,\ 12.
  2. d=9+16+144=169d=\sqrt{9+16+144}=\sqrt{169}.

Answer: d=13d=13.

Related formulas