Length of a line segment

Let A(x_1,y_1) and B(x_2,y_2) be the coordinates of a line segment AB. We have:

    \[\boxed{\textrm{\textbf{DISTANCE FORMULA:=}}\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}}\]

As in the case of the midpoint of a line segment, the above distance/length formula is very easy to use.

Example 1

Find the length of the line segment joining the points A(1,1) and B(2,2).

Let the length be l. We have, by the distance formula, that

    \[l=\sqrt{(2-1)^2+(2-1)^2}=\sqrt{1^2+1^2}=\sqrt{1+1}=\sqrt{2}.\]

Therefore, the line segment is \sqrt{2} units long.

Example 2

Find the distance from the origin to the point (-3,4).

Let the distance be d. Since the origin is the point (0,0), we have, by the distance formula, that

    \[d=\sqrt{(-3-0)^2+(4-0)^2}=\sqrt{9+16}=\sqrt{25}=5.\]

The required distance is 5 units.

Example 3

Find the distance between (\frac{1}{2},-3) and (\frac{3}{5},\frac{7}{8}).

By the distance formula, we have:

    \[d=\sqrt{\Big(\frac{3}{5}-\frac{1}{2}\Big)^2+\Big(\frac{7}{8}--3\Big)^2}=\sqrt{\frac{24041}{1600}}=\sqrt{15.025625}.\]

Using a calculator, we obtain that d\approx 3.88.

Example 4

Determine the possible value(s) of a for which the distance between (a,3) and (-1,-2) is 13 units.

We have, by the distance formula, that

    \[\sqrt{(a--1)^2+(3--2)^2}=13\]

We now simplify and solve:

    \begin{align*} \sqrt{(a+1)^2+(3+2)^2}&=13\\ \sqrt{(a+1)^2+5^2}&=13\\ \sqrt{(a+1)^2+25}&=13\\ (a+1)^2+25&=13^2\quad\textrm{square both sides}\\ (a+1)^2+25&=169\\ (a+1)^2&=169-25\\ (a+1)^2&=144\\ a+1&=\pm\sqrt{144}\quad\textrm{square ROOTS}\\ a+1&=\pm 12\\ a&=-1\pm 12\\ a&=-1+12\quad\textrm{or}\quad a=-1-12\\ a&=11\quad\textrm{or}\quad a=-13 \end{align}

Therefore, there are two possible values of a: 11 or -13.

Example 5

For any number k, prove that the distance between the points (k+1, k-1) and (k-2,k+3) is 5 units.

Let the distance be d. We have, by the distance formula, that:

    \begin{align*}d&=\sqrt{(k-2-(k+1))^2+(k+3-(k-1))^2}\\ &=\sqrt{(k-2-k-1)^2+(k+3-k+1)^2}\\ &=\sqrt{(-3)^2+(4)^2}\\ &=\sqrt{9+16}\\ &=\sqrt{25}\\ &=5, \end{align}

as required. This seems to suggest, as we would expect, that the length of a line segment is invariant under a translation.

Example 6

Let A(7,-9) be a given point. Find the coordinates of a point B that has a distance of 17 units from A. How many possibilities are there?

Let the coordinates of point B be (x,y). Since the distance between A and B is 17 units, we have, by the distance formula, that:

    \[\sqrt{(x-7)^2+(y--9)^2}=17\]

Squaring both sides gives (x-7)^2+(y+9)^2=17^2, or (x-7)^2+(y+9)^2=289. We now use trial-and-error (or, guess-and-check) to find a possible solution. Let’s try x=-1 and y=3:

    \[(-1-7)^2+(3+9)^2=(-8)^2+12^2=64+144=208.\]

Oops \cdots doesn’t work. Let’s try x=-1 and y=6:

    \[(-1-7)^2+(6+9)^2=(-8)^2+15^2=64+225=289.\]

Works! So, a possible choice of coordinates for B is (-1,6). Let’s see if we can find another set of coordinates. Put x=15 and y=6:

    \[(15-7)^2+(6+9)^2=8^2+15^2=64+225=289.\]

Works again!! Let’s try x=-8 and y=-1:

    \[(-8-7)^2+(-1+9)^2=(-15)^2+8^2=225+64=289.\]

Works again!!! In general, there’s an infinite number of solutions to this problem. Later on we’ll recognize the equation (x-7)^2+(y+9)^2=289 as that of a circle, and any point on (the circumference of) the circle is a solution.

Classifying triangles using the length formula

As you’ll recall, a triangle can be SCALENE (all three sides are of different lengths), ISOSCELES (two sides have the same length), or EQUILATERAL (all three sides have the same length). If we know the coordinates of the vertices of the triangle, we can use the distance formula to determine what type of triangle it is.

Example 7

What type of triangle is formed by the points A(0,0), ~B(1,2), ~C(-1,3)?

We’ll need to compare the lengths of the sides of the triangle. Let’s calculate the lengths of AB,BC, and CA using the distance formula:

    \begin{align*} AB&=\sqrt{(1-0)^2+(2-0)^2}\\ &=\sqrt{1^2+2^2}\\ &=\sqrt{1+4}\\ &=\sqrt{5}\\ &\vdots\cdots\\ BC&=\sqrt{(-1-1)^2+(3-2)^2}\\ &=\sqrt{(-2)^2+1^2}\\ &=\sqrt{4+1}\\ &=\sqrt{5}\\ &\vdots\cdots\\ CA&=\sqrt{(-1-0)^2+(3-0)^2}\\ &=\sqrt{(-1)^2+3^2}\\ &=\sqrt{1+9}\\ &=\sqrt{10} \end{align}

Since AB=BC, the given triangle is ISOSCELES. Additionally, this triangle contains 90^{\circ}, due to the fact that AB^2+BC^2=CA^2 (alternatively, this can also be seen by calculating the slopes of AB and BC, which are 2 and -1/2, respectively).

Example 8

Determine an appropriate choice of coordinates for points A,B,C such that the resulting triangle \triangle ABC will be equilateral.

In the exercises below, we give a general strategy for constructing an equilateral triangle using coordinates. For now, we use that knowledge to solve this challenge. Let’s choose A(-1,0),B(1,0),C(0,\sqrt{3}) and use the distance formula to find the lengths of AB,BC,CA:

    \begin{align*} AB&=\sqrt{(1--1)^2+(0-0)^2}\\ &=\sqrt{(1+1)^2+0}\\ &=\sqrt{2^2+0}\\ &=\sqrt{4}\\ &=2\\ &\vdots\cdots\\ BC&=\sqrt{(0-1)^2+(\sqrt{3}-0)^2}\\ &=\sqrt{(-1)^2+(\sqrt{3})^2}\\ &=\sqrt{1+3}\\ &=\sqrt{4}\\ &=2\\ &\vdots\cdots\\ CA&=\sqrt{(0--1)^2+(\sqrt{3}-0)^2}\\ &\sqrt{(0+1)^2+(\sqrt{3})^2}\\ &=\sqrt{1+3}\\ &=\sqrt{4}\\ &=2 \end{align}

It works! We conclude that the triangle \triangle ABC with coordinates at A(-1,0),B(1,0),C(0,\sqrt{3}) is equilateral.

How slope affects the length of a line segment

The slope formula and the distance formula are quite “similar” — in the sense that they both use the “same numbers” but with different operations on them:

    \[\textrm{\textbf{slope:=}}\frac{y_2-y_1}{x_2-x_1}; ~\textrm{\textbf{distance:=}}\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}\]

Because of this, we can expect some relationship between the two.

Example 9

Prove that if a line segment with integer coordinates has a slope of 1, then ITS LENGTH CAN NEVER BE AN INTEGER.

Let l be the length of a line segment AB that satisfies the specified condition. Suppose that A is the point (x_1,y_1) and B is the point (x_2,y_2). Since the slope of AB is 1, we have, by the slope formula, that

    \[1=\frac{y_2-y_1}{x_2-x_1},\quad\implies y_2-y_1=x_2-x_1.\]

We now have, by the distance formula, that

    \begin{align*} l&=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}\\ &=\sqrt{2(x_2-x_1)^2}\quad\textrm{or}~\sqrt{2(y_2-y_1)^2}\\ &=|(x_2-x_1)|\sqrt{2}\quad\textrm{or}~|(y_2-y_1)|\sqrt{2} \end{align}

The resulting length l is a positive integer multiple of \sqrt{2}. Since \sqrt{2} is not an integer, l is not.

In the next example, we prove that the same thing happens whenever the slope of the line segment is an integer other than 1 (excepting zero).

Example 10

Prove that if a line segment with integer coordinates has a slope m that is an integer, then ITS LENGTH CAN NEVER BE AN INTEGER.

As before, let l be the length of a line segment AB that satisfies the given condition. Suppose that A is the point (x_1,y_1) and B is the point (x_2,y_2). Since the slope of AB is m, we have, by the slope formula, that

    \[m=\frac{y_2-y_1}{x_2-x_1},\quad\implies y_2-y_1=m(x_2-x_1).\]

We now have, by the distance formula, that

    \begin{align*} l&=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}\\ &=\sqrt{(x_2-x_1)^2+(m(x_2-x_1))^2}\\ &=\sqrt{(x_2-x_1)^2+m^2(x_2-x_1)^2}\\ &=\sqrt{(x_2-x_1)^2(1+m^2)}\\ &=|(x_2-x_1)|\sqrt{1+m^2} \end{align}

The resulting length l is a positive integer multiple of \sqrt{1+m^2}. Since \sqrt{1+m^2} is not an integer (except when m=0), l is not.

Exercises for the reader

  1. Derive the distance formula; that is, prove that the distance d between (x_1,y_1) and (x_2,y_2) is given by
  2.     \begin{equation*} d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}. \end{equation}

  3. Prove that the distance between two points is invariant under a horizontal/vertical translation. In other words, prove that the distance between (x_1,y_1) and (x_2,y_2) is the same as the distance between (x_1+k,y_1+k) and (x_2+k,y_2+k), for any value of k.
  4. Let a,x,y be real numbers with a\neq 0. Prove that any triangle with vertices located at (x-a,y),(x+a,y),(x,y+a\sqrt{3}) is equilateral.