Distance Formula (2D)

The distance formula gives us a precise way to calculate the straight-line distance between any two points in the coordinate plane. Rather than relying on physical measurement, we use the coordinates of the points — their x and y values — to compute an exact numerical distance using only arithmetic and a square root. This is one of the most fundamental tools in coordinate geometry, allowing us to move seamlessly between geometric ideas (length, shape, size) and algebraic calculations. The formula is rooted in the Pythagorean theorem. When you plot two points on a coordinate grid, you can always form a right triangle by drawing a horizontal leg and a vertical leg connecting them. The straight-line distance between the two points is the hypotenuse of that triangle. By finding the lengths of the two legs — which simply require subtracting coordinates — and applying the Pythagorean theorem, we arrive at the distance formula. This connection to the Pythagorean theorem means the distance formula has been implicitly understood for millennia, even before modern coordinate notation existed. Mastery of the distance formula unlocks a wide range of problems in analytic geometry: verifying whether a triangle is equilateral or isosceles, determining whether a point lies on a circle, finding the radius of a circle from its equation, and much more. It also extends naturally to three dimensions and beyond, making it one of the most versatile formulas in all of mathematics.

Key takeaways
  • Plot the two points
  • Form a right triangle
  • Measure the two legs
  • Apply the Pythagorean theorem
  • Key properties to remember

Plot the two points

Let the two points be P₁ = (x₁, y₁) and P₂ = (x₂, y₂) on the Cartesian plane. We want to find the length of the straight line segment connecting them.

Form a right triangle

Introduce a third point R = (x₂, y₁). This point shares the x-coordinate of P₂ and the y-coordinate of P₁, so the segment P₁R is perfectly horizontal and the segment RP₂ is perfectly vertical. Together, P₁, R, and P₂ form a right angle at R.

Measure the two legs

The horizontal leg P₁R has length |x₂ − x₁| because both points share the same y-coordinate and we simply measure the horizontal gap. Similarly, the vertical leg RP₂ has length |y₂ − y₁|. Because these lengths are squared in the next step, the absolute value signs become unnecessary.

Apply the Pythagorean theorem

The Pythagorean theorem states that for a right triangle with legs a and b and hypotenuse c: c² = a² + b². Substituting our legs: d² = (x₂ − x₁)² + (y₂ − y₁)². Taking the positive square root (since distance is always non-negative): d = √[(x₂ − x₁)² + (y₂ − y₁)²]. This is the distance formula.

Key properties to remember

The order of subtraction does not matter because the differences are squared: (x₂ − x₁)² = (x₁ − x₂)². The distance is always zero when the two points coincide (same coordinates) and always positive otherwise. The formula works for any two points in the plane, including points on the same horizontal or vertical line, or even the same point.

The Key Equation

d=(x2−x1)2+(y2−y1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}
  • d — Distance (units (same as coordinate units)): The straight-line (Euclidean) distance between the two points P₁ and P₂. Always non-negative.
  • x_1,\, x_2 — x-coordinates of P₁ and P₂ (units): The horizontal positions of the first and second points on the coordinate plane.
  • y_1,\, y_2 — y-coordinates of P₁ and P₂ (units): The vertical positions of the first and second points on the coordinate plane.
  • (x_2 - x_1)^2 — Squared horizontal separation (units²): The square of the horizontal distance between the two points; corresponds to the square of one leg of the right triangle.
  • (y_2 - y_1)^2 — Squared vertical separation (units²): The square of the vertical distance between the two points; corresponds to the square of the other leg of the right triangle.

Worked Example

Problem. Find the distance between the points A = (1, 2) and B = (7, 10).

d=(7−1)2+(10−2)2=36+64=100=10d = \sqrt{(7-1)^2 + (10-2)^2} = \sqrt{36 + 64} = \sqrt{100} = 10

Answer. The distance between A and B is 10 units.

Figure
Diagram
xyP₁(1, 2)P₂(7, 10)Δx = 6Δy = 8d = 10O123456713579
Origins · 1 minRené Descartes and how this was discovered
RD
René Descartes
1596–1650 · French

Descartes invented the Cartesian coordinate system, published in his 1637 work La Géométrie (an appendix to his Discours de la Méthode). By assigning numerical coordinates to geometric points, he created analytic geometry — the bridge between algebra and geometry that makes the distance formula possible. The coordinate plane is named in his honour (Cartesian, from Cartesius, the Latin form of his name). According to a popular story, Descartes conceived the idea of coordinates while lying in bed watching a fly crawl across the ceiling, realising he could describe the fly's exact position using two numbers — its distances from the two walls.

  • Midpoint Formula — The midpoint formula uses the same coordinate subtraction ideas and is often introduced alongside the distance formula as the other fundamental measurement tool in coordinate geometry.
  • Pythagorean Theorem — The distance formula is a direct algebraic application of the Pythagorean theorem; understanding a² + b² = c² is essential to deriving and understanding why the distance formula works.
  • Equation of a Circle — The standard equation of a circle (x − h)² + (y − k)² = r² is derived directly from the distance formula: it expresses the condition that every point (x, y) on the circle is exactly r units from the centre (h, k).
  • Section Formula — The section formula divides a line segment in a given ratio and belongs to the same topic of Distance and Section in the Plane, building on coordinate geometry skills used in the distance formula.