2D Distance
d = √[(x₂−x₁)² + (y₂−y₁)²]
3D Distance
d = √[(x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²]
Navigation: Finding distances between GPS coordinates
Graphics: Calculating pixel distances in images
Physics: Measuring displacement between objects
Engineering: CAD/CAM measurements and tolerances
The distance formula is derived from the Pythagorean theorem and calculates the straight-line distance (Euclidean distance) between two points in a coordinate system. In two dimensions, given points (x₁, y₁) and (x₂, y₂), the distance d is calculated as d = √[(x₂−x₁)² + (y₂−y₁)²]. This formula essentially forms a right triangle where the horizontal and vertical distances are the legs, and the distance between points is the hypotenuse.
For three-dimensional space, the formula extends naturally to include the z-coordinate: d = √[(x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²]. This is crucial for applications in 3D graphics, physics simulations, robotics, and spatial analysis where objects exist in three-dimensional space.
Euclidean distance is the most common way to measure the "ordinary" straight-line distance between two points. Named after the ancient Greek mathematician Euclid, this metric is fundamental to geometry, physics, and many computational applications. It represents the shortest path between two points in Euclidean space.
While other distance metrics exist (such as Manhattan distance or Chebyshev distance), Euclidean distance is preferred when you need the actual "as the crow flies" distance. It's used extensively in machine learning for clustering algorithms, in computer graphics for collision detection, and in navigation systems for route calculation.
Disclaimer
Distance calculations follow standard Euclidean formulas. Results depend on correct coordinate input and selected dimension. For geographic distances on Earth's surface, consider using the Haversine formula which accounts for Earth's curvature.