### What do we mean by distance?

Distance is a tricky concept. Distance in a plane, like a chess board, is the straight-line distance between two points. But what is a straight line? Is it the shortest distance between two points? Doesn't that definition involve the concept of distance that we're trying to define in the first place?

It turns out that the concept of a straight line is one we have to take for granted — a postulate, a thing that must be assumed to exist or to be true in order for anything else to be built upon it. A straight line is a "line of zero curvature" or "the path of a point traveling in a constant direction." So we accept the definition that the distance between two points on a plane is the length of the straight line (line segment) that joins them.

#### Distance in a plane

The distance between two points on a plane is the length of the straight-line segment that connects them.

It gets strange when we move off of the plane. Consider: How far is it from one side of a room to another? From one part of a city to another? From one city to another? How far is it from Boston to Beijing? That one is tricky, because we know Earth is roughly a sphere, and when we travel from Boston to China, we take a curved path, not the straight one that drills through the middle of the planet.

How far apart are the two cities? There are two answers, right? So we have to be specific, at least in mathemiatics, about what we mean by distance. For most of our purposes, we'll be talking about distance on a plane.

### Distance on the plane: The Pythagorean Theorem

To determine the distance between any two points on a coordinate plane (just a plane to which we've assigned a coordinate system and some units, like cm), we use the Pythagorean theorem.

The figure at right shows two points with coordinates (x1, y1) and (x2, y2). The distances along the axes, y2-y1 and x2-x1 are parallel to the coordinate axes and therefore orthogonal (form a right angle).

Because the line segment representing the distance of interest makes a right triangle with these two differences, we can easily calculate the length of that segment (the distance between the points) using the Pythagorean Theorem:

$$d^2 = (x_2 - x_1)^2 + (y_2 - y_1)^2$$

#### The distance formula

The distance between two points in a plane, (x1, y1) and (x2, y2) is

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

This is just a re-statement of the Pythagorean theorem.

### Example 1

Calculate the distance between point p1 = (-3, 5) and p2 = (8, -1).

Solution: First let's organize our information. p1 = (-3, 5) and p2 = (8, -1), so

$$\begin{matrix} x_1 = -3, && x_2 = 8 \\[5pt] y_1 = 5, && y_2 = -1 \end{matrix}$$

Now plugging those into the distance formula will give us the distance. It doesn't matter whether we subtract x2 from x1 or x1 from x2, just that we're consistent from x to y. The trickiest part is usually keeping track of subtracting negative numbers (the same as adding).

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

Plugging in our numbers gives

$$d = \sqrt{(8 - (-3))^2 + (-1 - 5)^2}$$

Now pay attention to the negatives: 8 - (-3) = 8 + 3 = 11, and so on:

$$d = \sqrt{(11)^2 + (-6)^2}$$

Notice that if we'd subtracted the other way around we'd just have (-11)2 and (6)2, which, because squaring always yields a positive number, is the same. Taking the squares (before evaluating the radical) gives us

$$d = \sqrt{121 + 36}$$

... and finally the square root of the result gives us the distance between the points.

$$d = \sqrt{157} = \bf 12.53 \: units$$

### Practice problems

Find the distance between the following sets of points on the 2D plane:

 1 (-1, -1) and (2, 2) Solution \begin{align} d &= \sqrt{(2 -(-1))^2 + (2 -(-1))^2} \\ \\ &= \sqrt{9 + 9} = \sqrt{18} \\ \\ &= \bf 3 \sqrt{2} \: units \end{align} 2 (4, 3) and (3, 2) Solution \begin{align} d &= \sqrt{(4 - 3)^2 + (3 - 2)^2} \\ \\ &= \sqrt{1^2 + 1^2} \\ \\ &= \bf \sqrt 2 \: units \end{align} 3 (-2, -9) and (2, 2) Solution \begin{align} d &= \sqrt{(-2 - 2)^2 + (-9 - 2)^2} \\ \\ &= \sqrt{4^2 + 11^2} = \sqrt{16 + 121} \\ \\ &= \bf \sqrt{137} \: units \end{align}
 4 (6, 1) and (9, 3) Solution \begin{align} d &= \sqrt{(9 - 6)^2 + (3 - 1)^2} \\ \\ &= \sqrt{3^2 + 2^2} = \sqrt{9 + 4} \\ \\ &= \bf \sqrt{13} \: units \end{align} 5 (-4, -3) and (22, 8) Solution \begin{align} d &= \sqrt{(22 + 4)^2 + (8 + 3)^2} \\ \\ &= \sqrt{26^2 + 11^2} \\ \\ &= \bf \sqrt{797} \: units \\ \\ &\approx \, 28.23 \: units \end{align} 6 (-10, 100) and (6, 19) Solution \begin{align} d &= \sqrt{(6 + 10)^2 + (19 - 100)^2} \\ \\ &= \sqrt{6^2 + 81^2} = \sqrt{6187} \\ \\ &\approx \, \bf 82.5 \: units \end{align}

### Extension to three dimensions

To determine the distance between any two points on a 3-Dimensional coordinate grid, we just extend our formula with a term that brings in the z-components of the ordered triples of the endpoints.

The figure at right shows two points with coordinates (x1, y1, z1) and (x2, y2, z2). The distances along the axes, y2-y1, x2-x1, and z2-z1 are parallel to the coordinate axes.

Because the line segment representing the distance of interest makes a right triangle with these two differences, we can easily calculate the length of that segment (the distance between the points) using the Pythagorean Theorem:

$$d^2 = (x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2$$

#### Distance in n dimensions

We can easily extend the 2-d or 3-d distance formula to any number of dimensions:

$$d = \sqrt{(x_{12} - x_{11})^2 + (x_{22} - x_{21})^2 + \dots + (x_{n2} - x_{n1} )^2}$$

xaktly.com by Dr. Jeff Cruzan is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. © 2016, Jeff Cruzan. All text and images on this website not specifically attributed to another source were created by me and I reserve all rights as to their use. Any opinions expressed on this website are entirely mine, and do not necessarily reflect the views of any of my employers. Please feel free to send any questions or comments to jeff.cruzan@verizon.net.