The Distance Formula
Find the distance between two points with d = √((x₂−x₁)² + (y₂−y₁)²). Where it comes from (Pythagoras), the 3D version, and worked examples.
The Distance Formula
Most students search for the distance formula because they need to compute the length of a segment between two points on a coordinate plane. The formula itself is short: d = √((x₂ − x₁)² + (y₂ − y₁)²). Write it once, memorize it, and you have the tool.
The formula gives the Euclidean distance, the straight-line length between two points in the Cartesian coordinate system. It works for any two points, whether the coordinates are whole numbers, fractions, or negatives.
To use it, take the x-values, find the difference, square it, do the same for the y-values, add the two squares, then take the square root. That sequence never changes.
The most common failure is forgetting to subtract before squaring. A student who computes (x₁ − x₂)² + (y₁ − y₂)² instead of (x₂ − x₁)² + (y₂ − y₁)² gets the same answer because squaring drops the sign, but the consistent habit of subtracting the first point from the second prevents errors when the formula is extended.
Derivation From the Pythagorean Theorem
The distance formula is not a separate invention. It is the Pythagorean theorem rewritten for a coordinate grid. On a right triangle, a² + b² = c², where c is the hypotenuse. On a coordinate plane, the horizontal leg length is |x₂ − x₁| and the vertical leg length is |y₂ − y₁|. The distance between the two points is the hypotenuse.
If the two points form a horizontal or vertical line, one leg is zero and the formula reduces to the absolute difference of the non-matching coordinates. That is the distance formula working as expected, not a special case.
Understanding the derivation prevents the error of treating the distance formula as a memorized incantation. When a student sees why the formula exists, they can reconstruct it if they forget it, and they can extend it to three dimensions without help.
Worked Examples
Example 1: Two Points With Positive Coordinates
Find the distance between (1, 2) and (4, 6). Subtract the first x from the second: 4 − 1 = 3. Square: 9. Do the same for y: 6 − 2 = 4. Square: 16. Add: 25. Square root: 5. The segment length is 5 units.
Example 2: Negative Coordinates
Find the distance between (−3, −1) and (2, −5). Take the x difference: 2 − (−3) = 5. Square: 25. Take the y difference: −5 − (−1) = −4. Square: 16. Add: 41. Square root: √41 ≈ 6.403. The sign in the y subtraction is correct; the square removes it. The common error is to compute 2 − (−3) incorrectly, getting 1 instead of 5.
Example 3: Fractional Coordinates
Find the distance between (0.5, 1.25) and (3.75, 4.5). Take the x difference: 3.75 − 0.5 = 3.25. Square: 10.5625. Take the y difference: 4.5 − 1.25 = 3.25. Square: 10.5625. Add: 21.125. Square root: √21.125 ≈ 4.596. The square root of a decimal is not a clean number; that is normal. Leave it as a radical if the problem allows, or round to three decimal places.
Distance Formula 3D
The distance formula extends to three dimensions by adding the z-coordinate. For points (x₁, y₁, z₁) and (x₂, y₂, z₂), the length is d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). The derivation is the same: the Pythagorean theorem applied in three dimensions, where the distance is the diagonal of a rectangular prism.
Compute the three differences, square each, add, and take the square root. The order of subtraction does not matter because squaring eliminates the sign.
The failure mode for 3D distance is ignoring the z-coordinate entirely. A student who uses the 2D formula on a 3D problem gets the projection onto the xy-plane, not the true spatial distance. Always count the coordinates in the problem before choosing the formula.
Using Midpoint and Distance Together
The distance formula and the midpoint formula solve related problems. The midpoint formula gives the point exactly halfway between two endpoints. The distance formula gives the length of the segment those endpoints define. Together they answer questions like: given a diameter, find the radius.
If a circle has endpoints of a diameter at (1, 2) and (7, 10), the center is the midpoint of those endpoints. Compute the midpoint: ((1+7)/2, (2+10)/2) = (4, 6). The radius is half the distance between the endpoints. Compute the distance: √((7−1)² + (10−2)²) = √(36 + 64) = √100 = 10. The radius is 5 units. The circle equation can then be written as (x − 4)² + (y − 6)² = 25.
A student who confuses the midpoint with the centroid of a set of points will use the wrong point. The midpoint exists only between two endpoints. A set of three or more points has a centroid, not a midpoint. The research distinguishes these: a midpoint is the average of exactly two coordinates; a centroid is the average of three or more. Applying the midpoint formula to three points gives a meaningless average, not a geometric midpoint.
Common Errors and How to Avoid Them
Divide by Two When Using the Midpoint Formula
The most frequent mistake is forgetting to divide by two when using the midpoint formula. The midpoint formula is ((x₁ + x₂)/2, (y₁ + y₂)/2). Adding the coordinates without dividing gives the sum, not the midpoint.
Watch Signs With Negative Coordinates
Sign errors with negative coordinates are the second most common. When solving for a missing endpoint given one endpoint and the midpoint, a student who mishandles subtraction of negatives will get a wrong coordinate. For example, if the midpoint is (2, 3) and one endpoint is (−1, 5), the missing endpoint x-coordinate is 2×2 − (−1) = 4 + 1 = 5. The missing y-coordinate is 2×3 − 5 = 6 − 5 = 1. The missing endpoint is (5, 1). The operation is simple algebra, but the sign of the known coordinate must be preserved.
Check the Dimension Before You Start
Applying the 2D formula to 3D coordinates is a mistake that costs points on tests. The problem always states the dimension. Read it before writing anything.
Use the Right Formula for Geography
Using the Euclidean midpoint formula for geographic coordinates is a misuse of the formula. Geographic coordinates sit on a sphere, not a flat plane. The correct method is the Haversine formula, which gives the great-circle midpoint. The flat-earth approximation of averaging latitude and longitude directly works only for very short distances, under about 10 km, and even then the error compounds. For any real travel midpoint, use the spherical formula.
Frequently Asked Questions
What is the distance between two points if they have the same coordinates?
If the two points are identical, the distance is zero. The segment has no length. The distance formula gives √(0² + 0²) = 0. This is not a special case; it is the formula working correctly.
Can I use the distance formula for 3D points?
Yes. Use the 3D version: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). The formula extends to any number of dimensions by adding squared differences for each coordinate.
How do I find the radius of a circle from a diameter?
The radius is half the distance between the two endpoints of the diameter. Compute the distance between the endpoints using the distance formula, then divide by two. The center is the midpoint of those endpoints.
What is the difference between a midpoint and a centroid?
A midpoint is the average of exactly two endpoints of a line segment. A centroid is the average of three or more points, or the center of mass of a shape. Calling the average of three points a midpoint is a misapplication of the term.
Does the distance formula work for fractional and negative coordinates?
Yes. The formula works for any real numbers. Subtract, square, add, take the square root. The square removes the sign, so negative coordinates produce the same result as positive ones. Fractional coordinates require careful arithmetic but the formula is the same.