Distance Between Two Points (2D and 3D)
The Euclidean distance is the straight-line distance between two points.
It comes directly from the Pythagorean theorem: in 2D you form a right triangle with legs
\(\Delta x\) and \(\Delta y\); in 3D you extend the idea by adding \(\Delta z\).
2D distance formula
For points \(A(x_1,y_1)\) and \(B(x_2,y_2)\):
\[
d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
\]
Define the coordinate differences:
\(\Delta x=x_2-x_1\), \(\Delta y=y_2-y_1\).
Then \(d=\sqrt{(\Delta x)^2+(\Delta y)^2}\).
3D distance formula
For points \(A(x_1,y_1,z_1)\) and \(B(x_2,y_2,z_2)\):
\[
d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}
\]
Here \(\Delta z=z_2-z_1\), so the distance is
\(d=\sqrt{(\Delta x)^2+(\Delta y)^2+(\Delta z)^2}\).
Worked example (3D)
Let \(A(1,2,3)\), \(B(4,6,8)\).
Then \(\Delta x=3\), \(\Delta y=4\), \(\Delta z=5\), and:
\[
d=\sqrt{3^2+4^2+5^2}=\sqrt{9+16+25}=\sqrt{50}\approx 7.07
\]
Common uses
- Coordinate geometry: segment lengths, triangle side checks, perimeters.
- 3D geometry: distances in space, diagonals, point-to-point separations.
- Physics: displacement magnitude between positions (when motion is a straight line).
- Maps/GPS: approximate straight-line distance (not accounting for Earth curvature).
Notes and pitfalls
-
The Euclidean distance is always nonnegative: \(d\ge 0\).
It equals \(0\) only when the two points are identical.
-
Units: if coordinates are in meters, then distance is in meters; if coordinates are in kilometers, distance is in kilometers.
-
For very large coordinates, rounding may occur—this is normal in floating-point arithmetic.
Quick reference
\[
\Delta x=x_2-x_1,\quad \Delta y=y_2-y_1,\quad \Delta z=z_2-z_1
\]
\[
d_{2D}=\sqrt{(\Delta x)^2+(\Delta y)^2},\qquad
d_{3D}=\sqrt{(\Delta x)^2+(\Delta y)^2+(\Delta z)^2}
\]