Lines and Planes - Distances

In this section, I'll consider the problem of finding the distance between two objects, each of which is a point, a line, or a plane. Some of these cases have sub-cases: For instance, the problem of finding the distance between two parallel lines is different from the problem of finding the distance between two skew lines.

Example. Find the distance from the point $P(3, 3, 0)$ to the plane $x + y - 6 z = 3$ .

I'll find a point Q on the plane and construct the vector $\bvec{P Q}$ . The vector $\vec{v} = (1, 1, -6)$ is perpendicular to the plane. I'll compute $\comp_{\vec
   v} \bvec{P Q}$ , the component of $\bvec{P Q}$ on $\vec v$ .

$$\hbox{\epsfysize=1.5 in \epsffile{lines-planes-distances-1.eps}}$$

You can see from the picture that $|\comp_{\vec v} \bvec{P Q}|$ is the distance from the point to the plane.

To get a point Q on the plane, set two of the variables equal to numbers and solve for the third. For example, let $y = 0$ and $z =
   0$ . I get $x = 3$ , so $Q(3, 0, 0)$ is on the plane.

Therefore,

$$\bvec{P Q} = (0, -3, 0).$$

The component of $\bvec{P Q}$ on $\vec v$ is

$$\comp_{\vec v} \bvec{P Q} = \dfrac{\bvec{P Q}\cdot \vec{v}}{\|\vec{v}\|} = \dfrac{(0, -3, 0)\cdot (1, 1, -6)} {\|(1, 1, -6)\|} = \dfrac{-3}{\sqrt{38}}.$$

The distance from the point to the plane is $\dfrac{3}{\sqrt{38}} =
   0.48666 \ldots$ .


Example. Find the distance from the point $P(1, 1, -1)$ to the line

$$x = 1 - t, \quad y = 2 + t, \quad z = 2 t.$$

There is a formula for computing the distance from a point to a line, but I'll work this out by hand so you can see the idea.

I'll find a point Q on the line and construct the vector $\bvec{P Q}$ . The vector $\vec{v} = (-1, 1, 2)$ is parallel to the line. I'll compute the scalar component $\comp_{\vec v}\bvec{P Q}$ of $\bvec{P Q}$ on $\vec v$ .

$$\hbox{\epsfysize=1.5 in \epsffile{lines-planes-distances-2.eps}}$$

Finally, you can see from the picture that the distance is given by Pythagoras' theorem:

$$\hbox{distance} = \sqrt{\|\bvec{P Q}\|^2 - \left(\comp_{\vec v}\bvec{P Q}\right)^2}.$$

I can get a point on the line by setting t equal to some number (any number will do). Set $t
   = 0$ : I get $x = 1$ , $y =
   2$ , and $z = 0$ , so the point $Q(1, 2, 0)$ is on the line.

Therefore,

$$\bvec{P Q} = (0, 1, 1).$$

Hence,

$$\comp_{\vec v}\bvec{P Q} = \dfrac{\bvec{P Q}\cdot \vec{v}}{\|\vec{v}\|} = \dfrac{(0, 1, 1) \cdot (-1, 1, 2)} {\|(-1, 1, 2)\|} = \dfrac{0 + 1 + 2}{\sqrt{1 + 1 + 4}} = \dfrac{3}{\sqrt{6}}.$$

Hence,

$$\hbox{distance} = \left(\|(0, 1, 1)\|^2 - \left(\dfrac{3}{\sqrt{6}}\right)^2\right)^{1/2} = \left(2 - \dfrac{9}{36}\right)^{1/2} = \dfrac{\sqrt{7}}{2} = 1.32287 \ldots.\quad\halmos$$


Remark. There are essentially two kinds of distance problems involving points, lines, and planes. I'm ignoring the point-to-point problem, since for that you simply use the distance formula.

$$\vbox{\offinterlineskip \halign{& \vrule # & \strut \hfil \quad # \quad \hfil \cr \noalign{\hrule} height2pt & \omit & & \omit & \cr & Component on normal vector & & Component on normal vector and Pythagoras & \cr height2pt & \omit & & \omit & \cr \noalign{\hrule} height2pt & \omit & & \omit & \cr & Point to plane & & Point to line & \cr height2pt & \omit & & \omit & \cr \noalign{\hrule} height2pt & \omit & & \omit & \cr & Parallel planes & & Parallel lines & \cr height2pt & \omit & & \omit & \cr \noalign{\hrule} height2pt & \omit & & \omit & \cr & Parallel plane and line & & & \cr height2pt & \omit & & \omit & \cr \noalign{\hrule} height2pt & \omit & & \omit & \cr & Skew lines & & & \cr height2pt & \omit & & \omit & \cr \noalign{\hrule} }} $$

You can visualize parallel planes as the floor and the ceiling of a room.

In the line-to-plane case, the line and plane ought to be parallel; if not, they intersect, and the distance is 0. Since the line is parallel to the plane, think of the plane as the floor and the line as lying in the ceiling.

You can visualize skew lines using the ceiling-floor trick, too: Think of one line as lying in the floor and the other as lying in the ceiling, in such a way that the lines aren't parallel.

Finally, in the original point-to-plane case, the plane is the floor and the point lies in the ceiling.

The ceiling-floor picture explains why these four cases are really the same.


Example. The following lines are skew: They aren't parallel, and they don't intersect.

$$x = 3 + t, \quad y = 2 - 4 t, \quad z = t,$$

$$x = 4 - s, \quad y = 3 + s, \quad z = -2 + 3 s$$

Find the distance between the lines.

Picture one line lying in the ceiling and the other lying in the floor. The method we use is essentially the same as the method we'd use for the distance between parallel planes, or the distance from a point to a plane.

Set $t = 0$ : The point $P(3, 2, 0)$ lies in the first line.

Set $s = 0$ : The point $Q(4, 3, -2)$ lies in the second line. Then $\bvec{P Q} = (1, 1, -2)$ .

Next, I need a vector perpendicular to both the "ceiling" and the "floor", i.e. perpendicular to both lines. The vector $(1, -4, 1)$ is parallel to the first line, and the vector $(-1, 1, 3)$ is parallel to the second line. Hence, their cross product will be perpendicular to both lines:

$$\vec{v} = (1, -4, 1) \times (-1, 1, 3) = \left|\matrix{ \ihat & \jhat & \khat \cr 1 & -4 & 1 \cr -1 & 1 & 3 \cr}\right| = (-13, -4, -3).$$

$$\hbox{\epsfysize=2in \epsffile{lines-planes-distances-3.eps}}$$

To find the distance, I take the absolute value of the component of $\bvec{P Q}$ on $\vec{v}= (-13, -4, -3)$ :

$$\comp_{\vec{v}} \bvec{P Q} = \dfrac{(1, 1, -2) \cdot (-13, -4, -3)}{\|(-13, -4, -3)\|} = -\dfrac{11}{\sqrt{194}}.$$

The distance is $\dfrac{11}{\sqrt{194}} = 0.78975 \ldots$ .


Example. The following lines are parallel:

$$x = 1 + 3 s, \quad y = 2 - s, \quad z = 5 + 4 s.$$

$$x = 1 + 6 t, \quad y = -2 t, \quad z = 8 + 8 t.$$

Find the distance between them.

This example uses a setup like the one for the distance from a point to a line.

Setting $s = 0$ gives the point $P(1, 2, 5)$ on the first line.

Setting $t = 0$ gives the point $Q(1, 0, 8)$ on the second line.

Hence, $\bvec{P Q} = (0,
   -2, 3)$ is a vector from the first line to the second line.

The vector $(3, -1, 4)$ is parallel to the first line (and also to the second line, since the lines are parallel. Then

$$\comp_{(3, -1, 4)} \bvec{P Q} = \dfrac{(0, -2, 3) \cdot (3, -1, 4)}{\|(3, -1, 4)\|} = \dfrac{0 + 2 + 12}{\sqrt{26}} = \dfrac{14}{\sqrt{26}}.$$

$$\hbox{\epsfysize=2in \epsffile{lines-planes-distances-4.eps}}$$

The distance is given by Pythagoras:

$$\sqrt{\|\bvec{P Q}\|^2 - \left(\comp_{(3, -1, 4)} \bvec{P Q}\right)^2} = \sqrt{13 - \dfrac{196}{26}} = \sqrt{\dfrac{142}{26}} = \sqrt{\dfrac{71}{13}} = 2.33699 \ldots.\quad\halmos$$


Example. The following planes are parallel:

$$x + y - 3 z = 4 \quad\hbox{and}\quad -3 x - 3 y + 9 z = 18.$$

Find the distance between them.

This example uses a setup like the one for the distance from a point to a plane.

Setting $y = 0$ and $z = 0$ in the first plane gives $x = 4$ . The point $P(4, 0, 0)$ lies on the first plane.

Setting $y = 0$ and $z = 0$ in the second plane gives $-3 x = 18$ , so $x = -6$ . The point $Q(-6, 0, 0)$ lies on the second plane.

The vector $\bvec{P Q} =
   (-10, 0, 0)$ goes from the first plane to the second plane.

The vector $(1, 1, -3)$ is perpendicular to the first plane (and also to the second plane, since the planes are parallel).

$$\hbox{\epsfysize=2in \epsffile{lines-planes-distances-5.eps}}$$

The distance is given by the absolute value of the component of $\bvec{P Q}$ on the perpendicular vector $(1, 1, -3)$ :

$$\comp_{(1, 1, -3)} \bvec{P Q} = \dfrac{(-10, 0, 0) \cdot (1, 1, -3)}{\|(1, 1, -3)\|} = \dfrac{-10}{\sqrt{11}}.$$

The distance is given by the absolute value: $\dfrac{10}{\sqrt{11}} =
   3.01511 \ldots$ .


Example. The following line and plane are parallel:

$$x = 1 + 2 t, \quad y = -5 t, \quad z = 3 + 3 t.$$

$$2 x - y - 3 z = 1.$$

Find the distance between them.

Notice that I can think of the line as lying in a plane parallel to the given plane. So this is like finding the distance between two parallel planes.

$$\hbox{\epsfysize=2in \epsffile{lines-planes-distances-6.eps}}$$

Setting $t = 0$ in the line equations, I find that the point $P(1, 0, 3)$ lies on the line.

Setting $x = 0$ and $z = 0$ in the plane equation, I get $-y = 1$ , so $y
   = -1$ . Therefore, the point $Q(0, -1, 0)$ lies on the plane.

Hence, the point $\bvec{P Q} = (-1, -1, -3)$ goes from the line to the plane.

The vector $\vec{v} =
   (2, -1, -3)$ is perpendicular to the plane. Then

$$\comp_{\vec{v}} \bvec{P Q} = \dfrac{(-1, -1, -3) \cdot (2, -1, -3)}{\|(2, -1, -3)\|} = \dfrac{-2 + 1 + 9}{\sqrt{14}} = \dfrac{8}{\sqrt{14}}.$$

The distance is given by the absolute value of $\comp_{\vec{v}} \bvec{P Q}$ . The distance is $\dfrac{8}{\sqrt{14}} =
   2.13808 \ldots$ .

Contact information

Bruce Ikenaga's Home Page

Copyright 2018 by Bruce Ikenaga