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.

Lesson 5: Pythagorean theorem and distance between points

# Distance formula

Walk through deriving a general formula for the distance between two points.
The $\text{distance}$ between the points $\left({x}_{1},{y}_{1}\right)$ and $\left({x}_{2},{y}_{2}\right)$ is given by the following formula:
$\sqrt{\left({x}_{2}-{x}_{1}{\right)}^{2}+\left({y}_{2}-{y}_{1}{\right)}^{2}}$

## Deriving the distance formula

Let's start by plotting the points $\left({x}_{1},{y}_{1}\right)$ and $\left({x}_{2},{y}_{2}\right)$.
The length of the segment between the two points is the $\text{distance}$ between them:
We want to find the $\text{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 ${x}_{2}-{x}_{1}$:
Similarly, an expression for the length of the height is ${y}_{2}-{y}_{1}$:
Now we can use the Pythagorean theorem to write an equation:
${?}^{2}\phantom{\rule{0.167em}{0ex}}=\left({x}_{2}-{x}_{1}{\right)}^{2}+\left({y}_{2}-{y}_{1}{\right)}^{2}$
We can solve for $?$ by taking the square root of each side:
$?=\sqrt{\left({x}_{2}-{x}_{1}{\right)}^{2}+\left({y}_{2}-{y}_{1}{\right)}^{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.