Distance Calculator Formula & How It Works
- 2D: distance between (x₁,y₁) and (x₂,y₂)
- 3D: distance between (x₁,y₁,z₁) and (x₂,y₂,z₂)
- Midpoint: ((x₁+x₂)/2, (y₁+y₂)/2)
- Manhattan distance: |x₂−x₁| + |y₂−y₁| (city block distance)
The distance formula is the Pythagorean theorem applied to coordinate geometry. The horizontal and vertical differences form the two legs of a right triangle; the hypotenuse is the distance. Widely used in computer graphics, game development, machine learning (nearest neighbor), and navigation.