topic badge
Standard Level

3.02 Distance formula

Lesson

Horizontal and vertical distances

Horizontal

Points that lie on a horizontal line share the same $y$y-value.  They would have coordinates that look something like this: $\left(2,5\right)$(2,5) and $\left(-4,5\right)$(4,5). More generally, two points that lie on a horizontal line could have coordinates $\left(a,b\right)$(a,b) and $\left(c,b\right)$(c,b).

If you can recognise that the points lie on a horizontal line then the distance between them is the distance between the $x$x-values: the largest $x$x-value minus the smallest $x$x-value.

 

Worked example

example 1

Find the distance between $\left(2,5\right)$(2,5) and $\left(-4,5\right)$(4,5).

Think: Notice that because the $y$y-values are the same, these points lie on a horizontal line.

Do: The distance between them will be the largest $x$x-value ($2$2) minus the smallest $x$x-value ($-4$4)

$2-\left(-4\right)=2+4$2(4)=2+4 = $6$6 (remember subtracting a negative is the same as addition).  

 

Vertical

Points that lie on a vertical line share the same $x$x-value.  They would have coordinates that look something like this: $\left(2,5\right)$(2,5) and $\left(2,29\right)$(2,29). More generally, two points that lie on a vertical line could have coordinates $\left(a,b\right)$(a,b) and $\left(a,c\right)$(a,c).

If you can recognise that the points lie on a vertical line then the distance between them is the distance between the $y$y-values: the largest $y$y-value minus the smallest $y$y-value.

 

Worked example

example 2

Find the distance between $\left(2,5\right)$(2,5) and $\left(2,29\right)$(2,29).

Think:  Notice that because the $x$x-values are the same, these points lie on a vertical line.

Do: The distance between them will be the largest $y$y-value ($29$29) minus the smallest $y$y-value ($5$5)

$29-5=24$295=24 

 

Distance between two points

What if we want to find the distance between two points that are not on a horizontal or vertical line?

We already learned how to use Pythagoras' theorem to calculate the side lengths in a right triangle. Pythagoras' theorem states:

Pythagoras' theorem
$a^2+b^2$a2+b2 $=$= $c^2$c2
shorter side lengths   hypotenuse

The value $c$c is used to represent the hypotenuse which is the longest side of the triangle. The other two lengths are represented by $a$a and $b$b

 

We can also use Pythagoras' theorem to find the distance between two points on an $xy$xy-plane. Let's see how by looking at an example.

Worked example

example 3

Find the distance between $\left(-3,6\right)$(3,6) and $\left(5,4\right)$(5,4). Give your answer rounded to two decimal places.

Think:  Firstly, we can plot the points of an $xy$xy-plane like so:

Then we can draw a right-angled triangle by drawing a line between the two points, as well as a vertical and a horizontal line. The picture below shows one way to do it but there are others:

Once we've created the right-angled triangle, we can calculate the distances of the vertical and horizontal sides by counting the number of units:

Do:  On the $y$y-axis, the distance from $4$4 to $6$6  is $2$2 units and, on the $x$x-axis, the distance from $-3$3 to $5$5 is $8$8 units.

Then, we can use these values to calculate the length of the hypotenuse using Pythagoras' theorem.  The length of the hypotenuse will be the distance between our two points.

Reflect:  The good news is that we don't have to graph the points to be able to find the distance between two points. Since we know that a slanted line on the coordinate plane will always represent the hypotenuse of a right triangle, we can use the a variation of Pythagoras' theorem which is already solved for $c$c.

 

Example with variables

Let's do the same thing now, but with any two general points $A$A$\left(x_1,y_1\right)$(x1,y1) and $B$B$\left(x_2,y_2\right)$(x2,y2)

 

Sketch them on an $xy$xy-plane. (We don't know where these points are so we can represent them like this).

 

 

 

 

 

Draw a right triangle connecting the two points like this.

 

 

 

 

 

On the diagram mark the horizontal and vertical distances (calculate them like we did above). These are two of the side lengths of the right-angled triangle.

 

 

 

Use Pythagoras' theorem to calculate the distance on the hypotenuse.

$c^2=\left(x_2-x_1\right)^2+\left(y_2-y_1\right)^2$c2=(x2x1)2+(y2y1)2

$c=\sqrt{\left(x_2-x_1\right)^2+\left(y_2-y_1\right)^2}$c=(x2x1)2+(y2y1)2

(where $c$c is the distance between $A$A and $B$B)

What we have created here is called the distance formula.

We can use it to find the distance between any two points on the plane.

Distance Formula

The distance between two points $\left(x_1,y_1\right)$(x1,y1) and $\left(x_2,y_2\right)$(x2,y2) is given by:

$d=\sqrt{\text{run }^2+\text{rise }^2}$d=run 2+rise 2

$d=\sqrt{\left(x_2-x_1\right)^2+\left(y_2-y_1\right)^2}$d=(x2x1)2+(y2y1)2

Did you know?

By convention, we choose $\left(x_1,y_1\right)$(x1,y1) to be the left-most point, but as we are taking the square of the difference between the two values, it doesn't actually matter which one we choose.

 

Consider the two points $\left(-3,5\right)$(3,5) and $\left(1,2\right)$(1,2):

$d$d $=$= $\sqrt{1-\left(-3\right)^2+\left(2-5\right)^2}$1(3)2+(25)2
  $=$= $\sqrt{4^2+\left(-3\right)^2}$42+(3)2
  $=$= $\sqrt{16+9}$16+9
  $=$= $\sqrt{25}$25
  $=$= $5$5
$d$d $=$= $\sqrt{\left(-3-1\right)^2+\left(5-2\right)^2}$(31)2+(52)2
  $=$= $\sqrt{\left(-4\right)^2+3^2}$(4)2+32
  $=$= $\sqrt{16+9}$16+9
  $=$= $\sqrt{25}$25
  $=$= $5$5

We can see that we end up with the same final answer. That is, a distance of $5$5 units.

 

Practice questions

Question 1

The points $P$P $\left(-6,5\right)$(6,5), $Q$Q $\left(-6,2\right)$(6,2) and $R$R $\left(-2,2\right)$(2,2) are the vertices of a right-angled triangle, as shown on the number plane.

Loading Graph...

  1. Find the length of interval $PQ$PQ.

  2. Find the length of interval $QR$QR.

  3. If the length of $PR$PR is denoted by $c$c, use Pythagoras’ theorem to find the exact value of $c$c.

Question 2

Consider the interval $AC$AC that has been graphed on the number plane.

Find the length of interval $AC$AC, rounding your answer to two decimal places.

Loading Graph...

Question 3

$K$K is the midpoint of $A$A $\left(3,1\right)$(3,1) and $C$C $\left(15,-7\right)$(15,7). What is the distance from $A$A to $K$K correct to one decimal place?

What is Mathspace

About Mathspace