Ad Space — Top Banner

Distance Formula

Calculate the distance between two points in a coordinate plane using the distance formula d = √((x₂-x₁)² + (y₂-y₁)²).
Includes step-by-step examples.

The Formula

d = √((x₂ - x₁)² + (y₂ - y₁)²)

The distance formula calculates the straight-line distance between two points on a coordinate plane.

It is derived directly from the Pythagorean theorem.

Variables

SymbolMeaning
dThe distance between the two points
(x₁, y₁)Coordinates of the first point
(x₂, y₂)Coordinates of the second point

Example 1

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

x₁ = 1, y₁ = 2, x₂ = 4, y₂ = 6

d = √((4 - 1)² + (6 - 2)²)

d = √(3² + 4²) = √(9 + 16) = √25

d = 5

Example 2

Find the distance between (-3, 7) and (2, -1)

x₁ = -3, y₁ = 7, x₂ = 2, y₂ = -1

d = √((2 - (-3))² + (-1 - 7)²)

d = √(5² + (-8)²) = √(25 + 64) = √89

d ≈ 9.434

When to Use It

Use the distance formula when:

  • You need the straight-line distance between two points on a graph
  • Checking if a point lies on a circle (compare distance to the radius)
  • Solving geometry problems involving coordinate planes
  • Calculating lengths of line segments in analytic geometry

Key Notes

  • The formula is the Pythagorean theorem applied to the right triangle formed by the horizontal run (x₂−x₁) and vertical rise (y₂−y₁) — drawing this triangle is the best way to visualize why it works and catch errors
  • Order of subtraction never matters because both differences are squared: (x₂−x₁)² = (x₁−x₂)², so it makes no difference which point is "1" or "2" — a common worry that adds no actual constraint
  • Extends to 3D naturally: d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²); in n dimensions it becomes the Euclidean norm, which underpins k-nearest-neighbor classifiers, clustering algorithms, and vector similarity in machine learning
  • Do not use the distance formula for geographic (lat/lon) coordinates — the Earth is curved, so straight-line 2D distance is incorrect; use the Haversine formula or great-circle distance for accurate surface measurements

Ad Space — Bottom Banner

Embed This Calculator

Copy the code below and paste it into your website or blog.
The calculator will work directly on your page.