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 distance between the points (x1,y1) and (x2,y2) is given by the following formula:
(x2x1)2+(y2y1)2
In this article, we're going to derive this formula!

Deriving the distance formula

Let's start by plotting the points (x1,y1) and (x2,y2).
The length of the segment between the two points is the distance between them:
We want to find the distance. If we draw a right triangle, we'll be able to use the Pythagorean theorem!
An expression for the length of the base is x2x1:
Similarly, an expression for the length of the height is y2y1:
Now we can use the Pythagorean theorem to write an equation:
?2=(x2x1)2+(y2y1)2
We can solve for ? by taking the square root of each side:
?=(x2x1)2+(y2y1)2
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?