If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Distance formula

Walk through deriving a general formula for the distance between two points.
The start color #11accd, start text, d, i, s, t, a, n, c, e, end text, end color #11accd between the points left parenthesis, start color #1fab54, x, start subscript, 1, end subscript, end color #1fab54, comma, start color #e07d10, y, start subscript, 1, end subscript, end color #e07d10, right parenthesis and left parenthesis, start color #1fab54, x, start subscript, 2, end subscript, end color #1fab54, comma, start color #e07d10, y, start subscript, 2, end subscript, end color #e07d10, right parenthesis is given by the following formula:
square root of, left parenthesis, start color #1fab54, x, start subscript, 2, end subscript, minus, x, start subscript, 1, end subscript, end color #1fab54, right parenthesis, squared, plus, start color #e07d10, left parenthesis, y, start subscript, 2, end subscript, minus, y, start subscript, 1, end subscript, end color #e07d10, right parenthesis, squared, end square root
In this article, we're going to derive this formula!

Deriving the distance formula

Let's start by plotting the points left parenthesis, start color #1fab54, x, start subscript, 1, end subscript, end color #1fab54, comma, start color #e07d10, y, start subscript, 1, end subscript, end color #e07d10, right parenthesis and left parenthesis, start color #1fab54, x, start subscript, 2, end subscript, end color #1fab54, comma, start color #e07d10, y, start subscript, 2, end subscript, end color #e07d10, right parenthesis.
The first quadrant of a coordinate plane with two tick marks on the x axis labeled x one and x two. There are two tick marks on the y axis labeled y one and y two. There is a point at x one, y one and another point at x two, y two.
The length of the segment between the two points is the start color #11accd, start text, d, i, s, t, a, n, c, e, end text, end color #11accd between them:
The first quadrant of a coordinate plane with two tick marks on the x axis labeled x one and x two. There are two tick marks on the y axis labeled y one and y two. There is a point at x one, y one and another point at x two, y two. A line connects the two points.
We want to find the start color #11accd, start text, d, i, s, t, a, n, c, e, end text, end color #11accd. If we draw a right triangle, we'll be able to use the Pythagorean theorem!
The first quadrant of a coordinate plane with two tick marks on the x axis labeled x one and x two. There are two tick marks on the y axis labeled y one and y two. There is a point at x one, y one and another point at x two, y two. A line connects the two points. A third unlabeled point is at x two, y one with a line connecting from it to the point at x two, y two and another line connecting from it to the point at x one, y one forming a right triangle.
An expression for the length of the base is start color #1fab54, x, start subscript, 2, end subscript, minus, x, start subscript, 1, end subscript, end color #1fab54:
The first quadrant of a coordinate plane with two tick marks on the x axis labeled x one and x two. There are two tick marks on the y axis labeled y one and y two. There is a point at x one, y one and another point at x two, y two. A line connects the two points. A third unlabeled point is at x two, y one with a line connecting from it to the point at x two, y two and another line connecting from it to the point at x one, y one forming a right triangle. The hypotenuse of the right triangle is unknown and the side made from the point at x one, y one and x two, y one is labeled x two minus x one.
Similarly, an expression for the length of the height is start color #e07d10, y, start subscript, 2, end subscript, minus, y, start subscript, 1, end subscript, end color #e07d10:
The first quadrant of a coordinate plane with two tick marks on the x axis labeled x one and x two. There are two tick marks on the y axis labeled y one and y two. There is a point at x one, y one and another point at x two, y two. A line connects the two points. A third unlabeled point is at x two, y one with a line connecting from it to the point at x two, y two and another line connecting from it to the point at x one, y one forming a right triangle. The hypotenuse of the right triangle is unknown and the side made from the point at x one, y one and x two, y one is labeled x two minus x one. The third side is labeled y two minus y one.
Now we can use the Pythagorean theorem to write an equation:
start color #11accd, question mark, end color #11accd, squared, equals, left parenthesis, start color #1fab54, x, start subscript, 2, end subscript, minus, x, start subscript, 1, end subscript, end color #1fab54, right parenthesis, squared, plus, start color #e07d10, left parenthesis, y, start subscript, 2, end subscript, minus, y, start subscript, 1, end subscript, end color #e07d10, right parenthesis, squared
We can solve for start color #11accd, question mark, end color #11accd by taking the square root of each side:
start color #11accd, question mark, end color #11accd, equals, square root of, left parenthesis, start color #1fab54, x, start subscript, 2, end subscript, minus, x, start subscript, 1, end subscript, end color #1fab54, right parenthesis, squared, plus, start color #e07d10, left parenthesis, y, start subscript, 2, end subscript, minus, y, start subscript, 1, end subscript, end color #e07d10, right parenthesis, squared, end square root
That's it! We derived the distance formula!
Interestingly, a lot of people don't actually memorize this formula. Instead, they set up a right triangle, and use the Pythagorean theorem whenever they want to find the distance between two points.

Want to join the conversation?