How to Calculate the Distance Between Two Points
The distance formula lets you find the straight-line distance between any two points in a coordinate plane. It's derived directly from the Pythagorean theorem and appears in geometry, navigation, data science, and computer graphics.
The Distance Formula
Given two points (x₁, y₁) and (x₂, y₂):
d = √[(x₂ − x₁)² + (y₂ − y₁)²]
Step-by-Step Example
Find the distance between points (1, 2) and (4, 6).
- Calculate the horizontal difference: x₂ − x₁ = 4 − 1 = 3
- Calculate the vertical difference: y₂ − y₁ = 6 − 2 = 4
- Square both: 3² = 9, 4² = 16
- Add: 9 + 16 = 25
- Take the square root: √25 = 5
The distance is 5 units—and notice this is a classic 3-4-5 right triangle.
Why It Works (The Pythagorean Connection)
The two points form the endpoints of the hypotenuse of a right triangle. The horizontal difference is one leg, the vertical difference is the other, and the distance is the hypotenuse. Applying the Pythagorean theorem (a² + b² = c²) gives us the distance formula.
3D Distance Formula
For three-dimensional space with points (x₁, y₁, z₁) and (x₂, y₂, z₂):
d = √[(x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²]
Practical Applications
- GPS and mapping: Great-circle distance calculations for navigation
- Game development: Collision detection and pathfinding
- Data science: K-nearest neighbors algorithm uses Euclidean distance
- Physics: Calculating displacement between two positions
Use our distance calculator to compute distances between any two points.