The distance formula finds the straight-line length between two points on the coordinate plane: d = √(x2 − x1)2 + (y2 − y1)2. It is the Pythagorean theorem in disguise: the horizontal and vertical differences are the legs of a right triangle, and the distance is the hypotenuse.
Draw the right triangle under any two points. The legs are the changes in x and y, and the distance is the hypotenuse.
Formal definition and notation
For points P1(x1, y1) and P2(x2, y2) in the coordinate plane, the distance between them is d = √(x2 − x1)2 + (y2 − y1)2. The result is never negative and does not depend on which point is called first, because squaring removes the sign of each difference.
Slope divides the changes: y2 − y1x2 − x1. Distance squares and adds them, then takes the square root.
Quick check: 3 questions
Question 1 of 3
What is the distance between (1, 1) and (4, 5)?
Show answer and explanation
Answer: B.√32 + 42 = √25 = 5. 7 adds the legs, 25 forgets the square root, and √7 adds the differences before squaring.
Question 2 of 3
How far is (−5, −12) from the origin?
Show answer and explanation
Answer: C.√(−5)2 + (−12)2 = √169 = 13. 17 adds the absolute values, 7 subtracts them, and 169 forgets the square root.
Question 3 of 3
The distance from (2, k) to (5, 1) is 5, and k > 1. What is k?
Show answer and explanation
Answer: A.32 + (k − 1)2 = 25 gives (k − 1)2 = 16, so k − 1 = 4 and k = 5. −3 is the other solution, ruled out by k > 1; 4 is k − 1; 6 adds 5 to 1.
Distance Formula: frequently asked questions
How is the distance formula related to the Pythagorean theorem?
It is the same idea. Any two points form the ends of the hypotenuse of a right triangle whose legs are horizontal and vertical. The leg lengths are x2 − x1 and y2 − y1. The theorem a2 + b2 = c2 becomes d2 = (x2 − x1)2 + (y2 − y1)2, and taking the square root gives the formula.
Does it matter which point is first?
No. Swapping the points changes the sign of each difference, for example from 6 to −6, but squaring makes both 36. So d comes out the same. Choose the order that makes the subtraction easiest, and keep the same point first in both the x part and the y part.
What is the distance formula in 3D?
Add a third squared difference for the z-coordinates: d = √(x2 − x1)2 + (y2 − y1)2 + (z2 − z1)2. For (0, 0, 0) and (2, 3, 6), d = √4 + 9 + 36 = √49 = 7. The idea extends to any number of dimensions.
Updated November 2026·Reviewed by the Effortless Math team·Standards: CCSS 8.G.B.8, CCSS HSG-GPE.B.7
Cite this entry
Effortless Math Team. “Distance Formula.” Effortless Math Dictionary. Updated November 2026. https://www.effortlessmath.com/math-dictionary/distance-formula/
Flashcard
TermDistance Formulalength between two points
Definitiond = √(x2 − x1)2 + (y2 − y1)2. From (0, 0) to (3, 4): √25 = 5.
Coordinate PlaneThe coordinate plane is a flat grid formed by a horizontal x-axis and a vertical y-axis crossing at the origin, (0, 0). Every point is located by an ordered pair, x first then y, such as (3, −2). The two axes divide the plane into four quadrants, numbered I to IV counterclockwise from the upper right.Geometry · Grade 5, Grade 6, Grade 7Pythagorean TheoremThe Pythagorean theorem says that in a right triangle, a2 + b2 = c2. The legs are a and b, the two sides that form the right angle. The hypotenuse, c, is the longest side across from the right angle. Legs of 3 and 4 give 9 + 16 = 25, so the hypotenuse is 5.Geometry · Grade 8, Algebra 1HypotenuseThe hypotenuse is the longest side of a right triangle. It is always across from the right angle, and the two shorter sides that form the right angle are the legs. In the Pythagorean theorem a2 + b2 = c2, the hypotenuse is c: in a 3-4-5 right triangle, it is the side of length 5.Geometry · Grade 8, Algebra 1DifferenceA difference is the result of subtracting one number from another. In 12 − 7 = 5, the difference is 5. It tells how much bigger one number is than another, or how far apart they are on a number line. “The difference of a and b” means a − b, in that order.Operations · Grade 1, Grade 2, Grade 3LengthLength is how long something is: the distance from one end of an object to the other. You measure it by counting equal units laid end to end with no gaps or overlaps, such as inches, feet, centimeters or meters. A new pencil is about 7 inches long.Measurement · Grade 1, Grade 2, Grade 3NumberA number is an amount or value used to count, measure, order and compare. We write numbers with digits (7), words (seven) or other symbols, but the number itself is the amount: 7 dots, the word seven and the numeral 7 all show the same number. Numbers include whole numbers, fractions, decimals and negatives.Number System · Kindergarten, Grade 1, Grade 2OriginThe origin is the point where the x-axis and the y-axis cross on the coordinate plane. Its coordinates are (0, 0), and it is labeled O. Every ordered pair tells how far to move from the origin: (4, 3) means 4 units right, then 3 units up.Geometry · Grade 5, Grade 6, Grade 8Equation of a CircleThe equation of a circle with center (h, k) and radius r is (x − h)2 + (y − k)2 = r2. It says that every point (x, y) on the circle is exactly r units from the center. A circle centered at the origin has the simpler equation x2 + y2 = r2.Geometry · Geometry, Algebra 2, PrecalculusTriangleA triangle is a polygon with three sides and three angles. Its three corners are called vertices, and the angle measures in any triangle add to 180 degrees. Triangles are classified by their sides (equilateral, isosceles, scalene) and by their angles (acute, right, obtuse).Geometry · Grade 3, Grade 4, Grade 5PerimeterPerimeter is the total distance around a two-dimensional shape. To find it, add the lengths of all the sides. A rectangle with sides 5 and 3 has perimeter 5 + 3 + 5 + 3 = 16. Perimeter is a length, so it uses length units such as inches or meters, never square units.Geometry · Grade 3, Grade 4, Grade 5Square RootA square root of a number is a value that, multiplied by itself, gives that number. The square root of 36 is 6 because 6 × 6 = 36. Every positive number has two square roots, such as 6 and −6, but the radical sign √ means the principal square root, which is the non-negative one.Number System · Grade 8, Algebra 1AdditionAddition is the operation that puts amounts together to find the total. The numbers you add are called addends, the answer is the sum, and the sign is the plus sign, +. For example, 7 + 5 = 12. On a number line, adding a positive number means moving to the right.Operations · Kindergarten, Grade 1, Grade 2SquareA square is a quadrilateral with four equal sides and four right angles. It is a special rectangle and a special rhombus at the same time. For a square with side s, the perimeter is 4s, the area is s2, and each diagonal is s√2.Geometry · Kindergarten, Grade 2, Grade 3Midpoint FormulaThe midpoint formula gives the point halfway between (x1, y1) and (x2, y2): M = (x1 + x22, y1 + y22). You average the two x-coordinates and, separately, the two y-coordinates. For (2, 1) and (10, 7), the midpoint is (6, 4).Geometry · Grade 8, Algebra 1, GeometryAverageAn average is one number that stands for the typical size of the values in a data set. In everyday math, average means the mean: add all the values, then divide by how many values there are. In statistics, the median and the mode are also kinds of average.Statistics · Grade 5, Grade 6, Grade 7SlopeSlope is a number that measures how steep a line is: the change in y divided by the change in x between any two points on the line, often called rise over run. A positive slope rises from left to right, a negative slope falls, and a horizontal line has slope 0.Algebra · Grade 8, Algebra 1Right TriangleA right triangle is a triangle with one right angle, an angle of exactly 90 degrees. The two sides that form the right angle are the legs, and the longest side, across from the right angle, is the hypotenuse. Its sides follow the Pythagorean theorem: a2 + b2 = c2.Geometry · Grade 4, Grade 6, Grade 8Ordered PairAn ordered pair is two numbers written to locate a point on the coordinate plane. It is written as (x, y): the x-value comes first, and the y-value comes second. From the origin, move x units across, then y units up or down. The order matters: (2, 5) and (5, 2) are different points.Geometry · Grade 5, Grade 6, Grade 7