The distance between two points can be calculated using the distance formula. In turn, the distance formula is derived using the Pythagorean theorem in the Cartesian plane, where the distance represents the hypotenuse of a right triangle and the distances in *x* and *y* represent the legs of the triangle.

Here, we will learn how to derive the formula for the distance between two points. Also, we will use this formula to solve some practice problems.

## Formula for the distance between two points

The distance between two points with coordinates $latex (x_{1}, ~ y_{1})$ and $latex (x_{2}, ~ y_{2})$ can be calculated using the distance formula.

Distance formula$latex d=\sqrt{{{(x_{2}-x_{1})}^2}+{{(y_{2}-y_{1})}^2}}$ |

This is the formula that can be applied in the Cartesian plane, that is, in two-dimensional space. Additionally, if we want to calculate the distance between two points located in the three-dimensional plane, we have to use the distance formula in 3D:

Distance formula in 3D$latex d=\sqrt{{{(x_{2}-x_{1})}^2}+{{(y_{2}-y_{1})}^2}+{{(z_{2}-z_{1})}^2}}$ |

## How to derive the formula for the distance between two points?

To derive the formula for the distance between two points, we have to use the Pythagorean theorem on the Cartesian plane. Therefore, we are going to use the following diagram:

In the diagram, we have the points $latex A = (x_{1}, y_{1})$ and $latex B = (x_{2}, y_{2})$. We join these points with the segment AB, which we can denote with *d*. Then, we construct a right triangle where the segment AB is the hypotenuse and the segments AC and BC are the legs of the triangle.

When we apply the Pythagorean theorem to triangle ABC, we have:

$latex {{AB}^2}={{AC}^2}+{{BC}^2}$

We can see that the vertical distance between the points is equal to $latex | y_{2} -y_{1} |$ and the horizontal distance between the points is equal to $latex | x_{2} -x_{1} | $. Also, if we substitute AB with *d *, we have:

$latex {{d}^2}={{(x_{2}-x_{1})}^2}+{{(y_{2}-y_{1})}^2}$

Now, we take the square root of both sides to get the distance formula:

$latex d=\sqrt{{{(x_{2}-x_{1})}^2}+{{(y_{2}-y_{1})}^2}}$

## Examples with answers of distances between two points

The distance formula is used in the following examples to obtain the distance between two points. Each example has its respective solution, but it is recommended that you try to solve the problems yourself to practice.

**EXAMPLE 1**

Determine the distance between the points (1, 3) and (5, 6).

##### Solution

We write the coordinates of the points as follows:

- $latex (x_{1}, y_{1})=(1, 3)$
- $latex (x_{2}, y_{2})=(5, 6)$

Using the distance formula with these values, we have:

$latex d=\sqrt{{{(x_{2}-x_{1})}^2}+{{(y_{2}-y_{1})}^2}}$

$latex =\sqrt{{{(5-1)}^2}+{{(6-3)}^2}}$

$latex =\sqrt{{{(4)}^2}+{{(3)}^2}}$

$latex =\sqrt{16+9}$

$latex =\sqrt{25}$

$latex =5$

The distance between the points is equal to 5.

**EXAMPLE 2**

What is the distance between the points (2, 6) and (7, 10)?

##### Solution

We can write the coordinates of the points as follows:

- $latex (x_{1}, y_{1})=(2, 6)$
- $latex (x_{2}, y_{2})=(7, 10)$

We apply the distance formula with the given coordinates:

$latex d=\sqrt{{{(x_{2}-x_{1})}^2}+{{(y_{2}-y_{1})}^2}}$

$latex =\sqrt{{{(7-2)}^2}+{{(10-6)}^2}}$

$latex =\sqrt{{{(5)}^2}+{{(4)}^2}}$

$latex =\sqrt{25+16}$

$latex =\sqrt{51}$

$latex =7.14$

The distance is equal to 7.14.

**EXAMPLE 3**

If we have the points (12, 2) and (5, 5), what is their distance?

##### Solution

We can observe the following coordinates:

- $latex (x_{1}, y_{1})=(12, 2)$
- $latex (x_{2}, y_{2})=(5, 5)$

When we substitute these values into the distance formula, we have:

$latex d=\sqrt{{{(x_{2}-x_{1})}^2}+{{(y_{2}-y_{1})}^2}}$

$latex =\sqrt{{{(5-12)}^2}+{{(5-2)}^2}}$

$latex =\sqrt{{{(-7)}^2}+{{(3)}^2}}$

$latex =\sqrt{49+9}$

$latex =\sqrt{68}$

$latex =7.62$

The distance between the points is equal to 7.62.

**EXAMPLE 4**

Find the distance between the points (-4, 5) and (4, 9).

##### Solution

We have the following coordinates:

- $latex (x_{1}, y_{1})=(-4, 5)$
- $latex (x_{2}, y_{2})=(4, 9)$

Here, we have a point with negative coordinates. However, the distance formula can be used regardless of the coordinate signs.

$latex d=\sqrt{{{(x_{2}-x_{1})}^2}+{{(y_{2}-y_{1})}^2}}$

$latex =\sqrt{{{(4-(-4))}^2}+{{(9-5)}^2}}$

$latex =\sqrt{{{(8)}^2}+{{(4)}^2}}$

$latex =\sqrt{64+16}$

$latex =\sqrt{80}$

$latex =8.94$

The distance is equal to 8.94.

**EXAMPLE 5**

Determine the distance between the points (-6, -7) and (-2, -1).

##### Solution

We have the following coordinates:

- $latex (x_{1}, y_{1})=(-6, -7)$
- $latex (x_{2}, y_{2})=(-2, -1)$

Similar to the previous example, we just have to use the distance formula with the given coordinates.

$latex d=\sqrt{{{(x_{2}-x_{1})}^2}+{{(y_{2}-y_{1})}^2}}$

$latex =\sqrt{{{(-2-(-6))}^2}+{{(-1-(-7))}^2}}$

$latex =\sqrt{{{(4)}^2}+{{(6)}^2}}$

$latex =\sqrt{16+36}$

$latex =\sqrt{52}$

$latex =7.21$

The distance is equal to 7.21.

## Distance between two points – Practice problems

The following problems can be solved using what has been learned about the distance between two points. You can look at the distance formula written above or the solved examples in case you need help.

## See also

Interested in learning more about the midpoint, slope, and distance on the plane? Take a look at these pages:

### Learn mathematics with our additional resources in different topics

**LEARN MORE**