In this explainer, we will learn how to calculate the perpendicular distance between a point and a straight line or between two parallel lines in space using a formula.

To begin with, we recall that a single straight line is specified uniquely in space either if it passes through a known fixed point and has a known direction, as in diagram 1 below, or if the line passes through two known fixed points, as in diagram 2.

In the first case, the line, which has direction vector , passes through the point , which has position vector . If is any point on this line and is the position vector of , then
is the **vector equation** of the line. Here, is a scalar and each value of gives the position vector of one unique point on the line. Expanding on this, recall that we can express the equation of a line in three dimensions in the following ways.

### Definition: Forms of the Equation of a Line in Three Dimensions

In general, we can write the equation of a line parallel to the direction vector (where , , and are the unit vectors in the -, -, and -directions) and passing through the point as

The point with coordinates is one of infinitely many points on the line and , , and are called the **direction ratios**.

In the second case (diagram 2), for a line passing through two known fixed points and with associated vectors and , the direction vector of this line is given by . That is,

The direction ratios are then , and using either of or as a fixed point, we can again write the line in **vector**, **parametric**, or **Cartesian** forms.

In three dimensions, we can use the property of the cross product between vectors to calculate the perpendicular distance.

### Theorem: Cross Product between Vectors

For any three-dimensional vectors and , is the area of the parallelogram spanned by and .

We want to find the perpendicular distance between the point and the line .

The direction of our line is given by and the vector gives us a point on the line that we will call . We can then construct a parallelogram as shown in the following figure.

There are two ways of finding the area of this parallelogram. First, we can represent the nonparallel sides as vectors and , then the area of the parallelogram is equal to the magnitude of the cross product of these vectors:

Second, we can also find this area by recalling that the area of a parallelogram is the length of the base multiplied by its perpendicular height.

Considering that we add the perpendicular distance, , from point to the line onto our diagram, we find that can represent the base of the parallelogram and can represent the corresponding height of the base ; then, we have

Equating these two expressions for the area of the parallelogram gives us

We can rearrange this equation to make the subject:

We summarize the formula for finding the perpendicular distance between a point and a line.

### Theorem: Three-Dimensional Formula for the Distance between a Point and a Line

The perpendicular distance, , between a point and a line with direction vector is given by where is any point on the line.

It is worth noting that we can show that this is the shortest distance between any point and any line. If we choose an arbitrary point on line , then we can always draw the following perpendicular:

We can then see that is the hypotenuse of a right triangle and is therefore longer than the perpendicular distance.

Since this is the shortest distance between a point and a line in three dimensions, we refer to this as the distance between a point and a line in three dimensions.

Let us see some examples of how we can apply this formula to find the perpendicular distance between a point and a line in three dimensions.

### Example 1: Finding the Length of the Perpendicular Drawn from a Point to a Straight Line

Let be the line through the point in the direction of vector . Find the distance between and the point to the nearest hundredth.

### Answer

We want to find the perpendicular distance between a point and a straight line. We can do this by recalling the following result.

The perpendicular distance, , between a point and a line with direction vector is given by where is any point on the line.

In our case, , , and . To find the perpendicular distance, we first need to determine .

We start by finding :

We can use this to compute the cross product:

Then, we can calculate the magnitude of this vector:

Finally, the perpendicular distance is given by

Rounding to the nearest hundredth gives

Hence, the perpendicular distance between the point and the line through point in the direction of vector to the nearest hundredth is 4.98 length units.

### Example 2: Finding the Length of the Perpendicular Drawn from a Point to a Straight Line

Find the length of the perpendicular drawn from the point to the straight line rounded to the nearest hundredth.

### Answer

We want to find the perpendicular distance between a point and a straight line. We can do this by recalling the following result.

The perpendicular distance, , between the point and the line with direction vector is given by where is any point on the line.

We also recall that a line given in the vector form passes through the point with position vector and has the direction vector .

In our case, , and . To find the perpendicular distance, we first need to determine .

We start by finding :

We can use this to compute the cross product:

Then, we can calculate the magnitude of this vector:

Finally, the perpendicular distance is given by

Rounding to the nearest hundredth gives

Hence, the perpendicular distance between the point and the straight line , to the nearest hundredth, is 13.64 length units.

Let us see an example where we need to find the perpendicular distance between a point and a line whose equation is given in Cartesian form.

### Example 3: Determining the Length of the Perpendicular Drawn from a Given Point to a Straight Line

Determine, to the nearest hundredth, the length of the perpendicular drawn from the point to the straight line .

### Answer

We want to find the length of the perpendicular line between a point and a line whose equation is given in Cartesian form. To do this, we will first recall the following formula.

The perpendicular distance, , between a point and a line with direction vector can be found using the formula where is any point on the line.

Therefore, we can calculate the perpendicular distance by finding a point on the line and its direction vector. We can read off the direction vector from the denominators of the equation of the line as . We can solve each part of the equation equal to zero to find a point on the line, and this gives us the point .

Since we are given , we can find :

Then, the cross product between the vector and is

We can use this to compute the perpendicular distance between the point and the line:

Finally, rounding to the nearest hundredth, we have

Hence, we were able to find the shortest distance between the point and the straight line , and to the nearest hundredth the distance is 14.19.

In our next example, we will see how to apply this formula given two distinct points on the line instead of its equation.

### Example 4: Finding the Perpendicular Distance from a Given Point to the Line on Two Given Points

Find, to one decimal place, the perpendicular distance from point to the line on points and .

### Answer

Recall that the perpendicular distance, , between a point and a line with direction vector can be found by using the formula where is any point on the line.

We need to find its direction vector. If we name and , then we can find the direction vector of this line from the coordinates of these points:

We choose , giving us where

Evaluating the cross product yields

Hence,

Therefore,

In our previous example, we found the perpendicular distance between a point and a line defined by two points. The method used in this example gives us the following formula for the perpendicular distance.

### Distance between a Point and a Line Defined by Two Points

The perpendicular distance, , between and the line passing through distinct points and is given by

This formula is equivalent to the one we previously obtained for the distance between a point and a line using the equation of a line. We can see this by noticing that the vector is in fact the direction vector of this line. So, replacing by the direction vector recovers our previous formula.

In our final example, we will see how we can extend this process to find the distance between two parallel lines.

### Example 5: Finding the Distance between Two Parallel Lines

Find, to the nearest hundredth, the distance between the parallel lines and .

### Answer

To find the distance between and , we first need to determine exactly what this means. Let us consider the distance between an arbitrary point on each line, say and , as shown in the following figure.

We can see that this is not the shortest distance between these two lines by constructing the following right triangle.

The line segment is the hypotenuse of the right triangle, so it is longer than the perpendicular distance between the two lines, . Since the choice of and was arbitrary, we can see that will be shorter than the distance between any pair of points lying on either line.

We notice that because the lines are parallel, so the perpendicular distance will stay the same. Hence, we can calculate this perpendicular distance anywhere on the lines. If we choose an arbitrary point on , the perpendicular distance between a point and a line would be the same as the shortest distance between and .

We recall the following formula for the perpendicular distance between a point and a line. The perpendicular distance, , between a point and a line with direction vector can be found by using the formula where is any point on the line.

We can set each part of the equation of equal to 0 to find that lies on the line . We can also set each part of the equation of equal to zero to find that lies on . The direction vector of both lines is given by the denominators of their Cartesian equations: .

To find the perpendicular distance, we need to find :

Next, we find the cross product between and our direction vector:

Finally, the perpendicular distance between the two parallel lines is given by

Rounding to the nearest hundredth gives us

Hence, the distance between and to the nearest hundredth is 18.03 length units.

Let us finish by recapping a few important points from this explainer.

### Key Points

- The perpendicular distance between a point and a line is the shortest distance between these two objects.
- In three dimensions, the perpendicular distance, , between a point and a line with direction vector is given by where is any point on the line.
- In three dimensions, the perpendicular distance, , between a point and the line passing through the distinct points and is given by
- We can find the perpendicular distance between two distinct parallel lines by finding the perpendicular distance between one line and any point on the other line.