Skip to main content
Logo image

Elementary Linear Algebra: For University of Lethbridge Math 1410

Section 2.5 Lines

To find the equation of a line in the \(xy\)-plane, we need two pieces of information: a point and the slope. The slope conveys direction information. As vertical lines have an undefined slope, the following statement is more accurate:
To define a line, one needs a point on the line and the direction of the line.
This holds true for lines in space.

Subsection 2.5.1 Lines in space

Let \(P\) be a point in space, let \(\vec p\) be the vector with initial point at the origin and terminal point at \(P\) (i.e., \(\vec p\) “points” to \(P\)), and let \(\vec d\) be a vector. Consider the points on the line through \(P\) in the direction of \(\vec d\text{.}\)
Clearly one point on the line is \(P\text{;}\) we can say that the vector \(\vec p\) lies at this point on the line. To find another point on the line, we can start at \(\vec p\) and move in a direction parallel to \(\vec d\text{.}\) For instance, starting at \(\vec p\) and traveling one length of \(\vec d\) places one at another point on the line. Consider Figure 2.5.1 where certain points along the line are indicated.
Figure 2.5.1. Defining a line in space
The figure illustrates how every point on the line can be obtained by starting with \(\vec p\) and moving a certain distance in the direction of \(\vec d\text{.}\) That is, we can define the line as a function of \(t\text{:}\)
\begin{equation} \vec\ell(t) = \vec p + t\ \vec d\text{.}\tag{2.5.1} \end{equation}
In many ways, this is not a new concept. Compare Equation (2.5.1) to the familiar “\(y=mx+b\)” equation of a line:
A text description, comparing the elements the equations of a line in the plane, and in space.
On the left is the equation \(y=mx+b\) for a line in the plane with slope \(m\) and \(y\) intercept \(b\text{.}\) On the right is the equation \(\vec{\ell}(t) = \vec p + t\vec d\) for a line in space through the point \(\vec p\) with direction vector \(\vec d\text{.}\)
Above the two equations is the text “Starting Point”. From this text are two arrows, pointing to the value \(b\) in the plane equation, and the value \(\vec p\) in the space equation. Also above the equations is the text “Direction”. From this text, two arrows point to the value \(m\) in the plane equation, and the value \(\vec d\) in the space equation.
Below the two equations is the text “How Far To Go In That Direction”. Arrows point from this text to the value \(x\) in the plane equation, and the value \(t\) in the space equation.
Figure 2.5.2. Understanding the vector equation of a line
The equations exhibit the same structure: they give a starting point, define a direction, and state how far in that direction to travel.
There are other ways to represent a line. Let \(P = (x_0,y_0,z_0)\text{,}\) \(\vec p = \bbm x_0\\y_0\\z_0\ebm\text{,}\) and let \(\vec d = \bbm a\\b\\c\ebm\text{.}\) Then the equation of the line through \(P\) in the direction of \(\vec d\) is:
\begin{align*} \vec\ell(t) \amp = \vec p + t\vec d\\ \amp = \bbm x_0\\y_0\\z_0\ebm + t\bbm a\\b\\c\ebm\\ \amp = \bbm x_0 + at\\ y_0+bt\\ z_0+ct\ebm\text{.} \end{align*}
The last line states that the \(x\) values of the line are given by \(x=x_0+at\text{,}\) the \(y\) values are given by \(y = y_0+bt\text{,}\) and the \(z\) values are given by \(z = z_0 + ct\text{.}\) These three equations, taken together, are the parametric equations of the line through \(\vec p\) in the direction of \(\vec d\text{.}\)
Finally, each of the equations for \(x\text{,}\) \(y\) and \(z\) above contain the variable \(t\text{.}\) We can solve for \(t\) in each equation:
\begin{align*} x = x_0+at \amp \Rightarrow t=\frac{x-x_0}{a},\\ y=y_0+bt \amp \Rightarrow t = \frac{y-y_0}{b},\\ z = z_0+ct \amp \Rightarrow t = \frac{z-z_0}{c}\text{,} \end{align*}
assuming \(a,b,c\neq 0\text{.}\) Since \(t\) is equal to each expression on the right, we can set these equal to each other, forming the symmetric equations of the line through \(\vec p\) in the direction of \(\vec d\text{:}\)
\begin{equation*} \frac{x-x_0}{a} = \frac{y-y_0}{b}=\frac{z-z_0}{c}\text{.} \end{equation*}
Each representation has its own advantages, depending on the context. We summarize these three forms in the following definition, then give examples of their use.

Definition 2.5.3. Equations of Lines in Space.

Let \(P = (x_0,y_0,z_0)\) and let \(\vec p = \bbm x_0\\y_0\\z_0\ebm\text{.}\) Consider the line in space that passes through \(P\) in the direction of \(\vec d = \bbm a\\b\\c\ebm\text{.}\)
  1. The vector equation of the line is
    \begin{equation*} \vec \ell(t) = \vec p+t\vec d\text{.} \end{equation*}
  2. The parametric equations of the line are
    \begin{equation*} x = x_0+at, y=y_0+bt, z = z_0+ct\text{.} \end{equation*}
  3. The symmetric equations of the line are
    \begin{equation*} \frac{x-x_0}{a} = \frac{y-y_0}{b}=\frac{z-z_0}{c}\text{.} \end{equation*}

Example 2.5.4. Finding the equation of a line.

Give all three equations, as given in Definition 2.5.3, of the line through \(P = (2,3,1)\) in the direction of \(\vec d = \bbm -1\\1\\2\ebm\text{.}\) Does the point \(Q=(-1,6,6)\) lie on this line?
Solution.
We identify the point \(P=(2,3,1)\) with the vector \(\vec p =\bbm 2\\3\\1\ebm\text{.}\) Following the definition, we have
  • the vector equation of the line is \(\vec\ell(t) = \bbm 2\\3\\1\ebm + t\bbm -1\\1\\2\ebm\text{;}\)
  • the parametric equations of the line are
    \begin{equation*} x = 2-t, y = 3+t, z = 1+2t; \text{ and } \end{equation*}
  • the symmetric equations of the line are
    \begin{equation*} \frac{x-2}{-1}=\frac{y-3}{1} = \frac{z-1}{2}\text{.} \end{equation*}
Figure 2.5.5. Graphing a line in Example 2.5.4
The first two equations of the line are useful when a \(t\) value is given: one can immediately find the corresponding point on the line. These forms are good when calculating with a computer; most software programs easily handle equations in these formats. (For instance, the graphics program that made Figure 2.5.5 can be given the input “(2-t,3+t,1+2*t)” for \(-1\leq t\leq 3\text{.}\)).
Does the point \(Q = (-1,6,6)\) lie on the line? The graph in Figure 2.5.5 makes it clear that it does not. We can answer this question without the graph using any of the three equation forms. Of the three, the symmetric equations are probably best suited for this task. Simply plug in the values of \(x\text{,}\) \(y\) and \(z\) and see if equality is maintained:
\begin{equation*} \frac{-1-2}{-1} \stackrel{?}{=} \frac{6-3}{1} \stackrel{?}{=} \frac{6-1}{2} \Rightarrow 3=3\neq2.5\text{.} \end{equation*}
We see that \(Q\) does not lie on the line as it did not satisfy the symmetric equations.

Example 2.5.6. Finding the equation of a line through two points.

Find the parametric equations of the line through the points \(P=(2,-1,2)\) and \(Q = (1,3,-1)\text{.}\)
Solution.
Recall the statement made at the beginning of this section: to find the equation of a line, we need a point and a direction. We have two points; either one will suffice. The direction of the line can be found by the vector with initial point \(P\) and terminal point \(Q\text{:}\) \(\overrightarrow{PQ} = \bbm -1\\4\\-3\ebm\text{.}\)
The parametric equations of the line \(\ell\) through \(P\) in the direction of \(\overrightarrow{PQ}\) are:
\begin{equation*} \ell: x= 2-t y=-1+4t z=2-3t\text{.} \end{equation*}
Figure 2.5.7. A graph of the line in Example 2.5.6
A graph of the points and line are given in Figure 2.5.7. Note how in the given parametrization of the line, \(t=0\) corresponds to the point \(P\text{,}\) and \(t=1\) corresponds to the point \(Q\text{.}\) This relates to the understanding of the vector equation of a line described in Figure 2.5.2. The parametric equations “start” at the point \(P\text{,}\) and \(t\) determines how far in the direction of \(\overrightarrow{PQ}\) to travel. When \(t=0\text{,}\) we travel 0 lengths of \(\overrightarrow{PQ}\text{;}\) when \(t=1\text{,}\) we travel one length of \(\overrightarrow{PQ}\text{,}\) resulting in the point \(Q\text{.}\)

Subsection 2.5.2 Parallel, Intersecting and Skew Lines

In the plane, two distinct lines can either be parallel or they will intersect at exactly one point. In space, given equations of two lines, it can sometimes be difficult to tell whether the lines are distinct or not (i.e., the same line can be represented in different ways). Given lines \(\vec\ell_1(t) = \vec p_1 + t\vec d_1\) and \(\vec \ell_2(t) = \vec p_2+t\vec d_2\text{,}\) we have four possibilities: \(\vec \ell_1\) and \(\vec \ell_2\) are
the same line
they share all points
intersecting lines
they share only 1 point;
parallel lines
\(\vec d_1\parallel \vec d_2\text{,}\) no points in common;
skew lines
\(\vec d_1\nparallel \vec d_2\text{,}\) no points in common.
The next two examples investigate these possibilities.

Example 2.5.8. Comparing lines.

Consider lines \(\ell_1\) and \(\ell_2\text{,}\) given in parametric equation form:
\begin{equation*} \ell_1:\, \begin{matrix} x\amp =\amp 1+3t \\ y\amp =\amp 2-t\\ z\amp =\amp t \end{matrix}\qquad\qquad \ell_2:\, \begin{matrix} x\amp =\amp -2+4s\\ y\amp =\amp 3+s\\ z\amp =\amp 5+2s \end{matrix}\text{.} \end{equation*}
Determine whether \(\ell_1\) and \(\ell_2\) are the same line, intersect, are parallel, or skew.
Solution.
We start by looking at the directions of each line. Line \(\ell_1\) has the direction given by \(\vec d_1=\bbm 3\\-1\\1\ebm\) and line \(\ell_2\) has the direction given by \(\vec d_2 = \bbm 4\\1\\2\ebm\text{.}\) It should be clear that \(\vec d_1\) and \(\vec d_2\) are not parallel, hence \(\ell_1\) and \(\ell_2\) are not the same line, nor are they parallel. Figure 2.5.9 verifies this fact (where the points and directions indicated by the equations of each line are identified).
Figure 2.5.9. Sketching the lines from Example 2.5.8
We next check to see if they intersect (if they do not, they are skew lines). To find if they intersect, we look for \(t\) and \(s\) values such that the respective \(x\text{,}\) \(y\) and \(z\) values are the same. That is, we want \(s\) and \(t\) such that:
\begin{equation*} \begin{matrix} 1+3t \amp =\amp -2+4s\\ 2-t\amp =\amp 3+s\\ t\amp =\amp 5+2s \end{matrix}\text{.} \end{equation*}
This is a relatively simple system of linear equations. Since the last equation is already solved for \(t\text{,}\) substitute that value of \(t\) into the equation above it:
\begin{equation*} 2-(5+2s) = 3+s \Rightarrow s=-2,\ t=1\text{.} \end{equation*}
A key to remember is that we have three equations; we need to check if \(s=-2,\ t=1\) satisfies the first equation as well:
\begin{equation*} 1+3(1) \neq -2+4(-2)\text{.} \end{equation*}
It does not. Therefore, we conclude that the lines \(\ell_1\) and \(\ell_2\) are skew.

Example 2.5.10. Comparing lines.

Consider lines \(\ell_1\) and \(\ell_2\text{,}\) given in parametric equation form:
\begin{equation*} \ell_1:\, \begin{matrix} x\amp =\amp -0.7+1.6t \\ y\amp =\amp 4.2+2.72t\\z\amp =\amp 2.3-3.36t \end{matrix} \qquad\qquad \ell_2:\,\begin{matrix} x\amp =\amp 2.8-2.9s\\y\amp =\amp 10.15-4.93s\\z\amp =\amp -5.05+6.09s. \end{matrix} \end{equation*}
Determine whether \(\ell_1\) and \(\ell_2\) are the same line, intersect, are parallel, or skew.
Solution.
It is obviously very difficult to simply look at these equations and discern anything. This is done intentionally. In the “real world,” most equations that are used do not have nice, integer coefficients. Rather, there are lots of digits after the decimal and the equations can look “messy.”
We again start by deciding whether or not each line has the same direction. The direction of \(\ell_1\) is given by \(\vec d_1 = \bbm 1.6\\2.72\\-3.36\ebm\) and the direction of \(\ell_2\) is given by \(\vec d_2 = \bbm -2.9\\-4.93\\6.09\ebm\text{.}\) When it is not clear through observation whether two vectors are parallel or not, the standard way of determining this is by comparing their respective unit vectors. Using a calculator, we find:
\begin{align*} \vec u_1 \amp = \frac{\vec d_1}{\norm{\vec d_1}} = \bbm 0.3471\\0.5901\\-0.7289\ebm\\ \vec u_2 \amp = \frac{\vec d_2}{\norm{\vec d_2}} = \bbm -0.3471\\-0.5901\\0.7289\ebm\text{.} \end{align*}
The two vectors seem to be parallel (at least, their components are equal to 4 decimal places). In most situations, it would suffice to conclude that the lines are at least parallel, if not the same. One way to be sure is to rewrite \(\vec d_1\) and \(\vec d_2\) in terms of fractions, not decimals. We have
\begin{equation*} \vec d_1 =\bbm \frac{16}{10}\\\frac{272}{100}\\-\frac{336}{100}\ebm \qquad \vec d_2 = \bbm -\frac{29}{10}\\-\frac{493}{100}\\\frac{609}{100}\ebm\text{.} \end{equation*}
One can then find the magnitudes of each vector in terms of fractions, then compute the unit vectors likewise. After a lot of manual arithmetic (or after briefly using a computer algebra system), one finds that
\begin{equation*} \vec u_1 = \bbm \sqrt{\frac{10}{83}}\\\frac{17}{\sqrt{830}}\\-\frac{21}{\sqrt{830}}\ebm \qquad \vec u_2 = \bbm -\sqrt{\frac{10}{83}}\\-\frac{17}{\sqrt{830}}\\\frac{21}{\sqrt{830}}\ebm\text{.} \end{equation*}
We can now say without equivocation that these lines are parallel.
Are they the same line? The parametric equations for a line describe one point that lies on the line, so we know that the point \(P_1 = (-0.7,4.2,2.3)\) lies on \(\ell_1\text{.}\) To determine if this point also lies on \(\ell_2\text{,}\) plug in the \(x\text{,}\) \(y\) and \(z\) values of \(P_1\) into the symmetric equations for \(\ell_2\text{:}\)
\begin{align*} \frac{(-0.7)-2.8}{-2.9} \amp \stackrel{?}{=} \frac{(4.2)-10.15}{-4.93} \stackrel{?}{=} \frac{(2.3)-(-5.05)}{6.09}\\ 1.2069\amp=1.2069=1.2069\text{.} \end{align*}
Figure 2.5.11. Graphing the lines in Example 2.5.10
The point \(P_1\) lies on both lines, so we conclude they are the same line, just parametrized differently. Figure 2.5.11 graphs this line along with the points and vectors described by the parametric equations. Note how \(\vec d_1\) and \(\vec d_2\) are parallel, though point in opposite directions (as indicated by their unit vectors above).

Subsection 2.5.3 Distances

Given a point \(Q\) and a line \(\vec\ell(t) = \vec p+t\vec d\) in space, it is often useful to know the distance from the point to the line. (Here we use the standard definition of “distance,” i.e., the length of the shortest line segment from the point to the line.) Identifying \(\vec p\) with the point \(P\text{,}\) Figure 2.5.12 will help establish a general method of computing this distance \(h\text{.}\)
Our method will be based on the Orthogonal Projection from Section 2.3. Although it is possible to derive a formula that gives the distance immediately, our method will help develop geometric intuition that we can adapt to later situations, and it also has the advantage of letting us identify the point \(R\) on the line that is closest to \(Q\text{.}\)
The basic idea is that the vector \(\overrightarrow{PR}\) must be the orthogonal projection of the vector \(\overrightarrow{PQ}\) onto the direction vector \(\vec d\text{.}\)
A line through a point P, with direction d. Near the line is a point Q, whose distance to the line is shown as the height h of a triangle.
A generic line is shown, without coordinates. On the line is a point \(P\) and a direction vector \(\vec{d}\text{.}\) Near the line is a point \(Q\text{.}\) The vector \(\overrightarrow{PQ}\) points from the point \(P\) on the line to the point \(Q\) off the line. This vector forms the hypotenuse of a right-angled triangle whose base is part of the line, and whose height, \(h\text{,}\) is shown as a dashed line segment from \(Q\) to the line. The angle \(\theta\) between \(\vec d\) and \(\overrightarrow{PQ}\) is also shown. The height \(h\) is the perpendicular distance from \(Q\) to the line.
Figure 2.5.12. Establishing the distance from a point to a line

Example 2.5.13. Finding the distance from a point to a line.

Find the distance from the point \(Q=(1,1,3)\) to the line \(\vec\ell(t) = \bbm 1\\-1\\1\ebm+t\bbm 2\\3\\1\ebm.\)
Solution.
From the equation of the line, we know that the point \(P=(1,-1,1)\) is on the line, and that the vector \(\vec{d}=\bbm 2\\3\\1\ebm\) is in the direciton of the line. Let
\begin{equation*} \vec {v} = \overrightarrow{PQ} = \bbm 1-1\\1-(-1)\\3-1\ebm = \bbm 0\\2\\2\ebm\text{.} \end{equation*}
We know that if \(R\) is the point on the line closest to \(Q\text{,}\) then the projection of \(\vec{v}\) onto \(\vec d\) will equal \(\overrightarrow{PR}\text{.}\)
We compute
\begin{equation*} \proj vd = \frac{\dotp vd}{\dotp dd}\vec{d} = \frac{0+6+2}{4+9+1}\bbm 2\\3\\1\ebm = \frac47\bbm 2\\3\\1\ebm\text{.} \end{equation*}
Now, if \(R=(x_1,y_1,z_1)\text{,}\) we know that \(\overrightarrow{PR} = \bbm x_1-1\\x_2-(-1)\\x_3-1\ebm\text{,}\) since \(P=(1,-1,1)\text{.}\) This gives us \(\bbm x_1-1\\x_2-(-1)\\x_3-1\ebm=\frac47\bbm 2\\3\\1\ebm\text{,}\) so \(x_1 = 1+\frac87 = \frac{15}{7}\text{,}\) \(x_2 = -1+\frac{12}{7}=\frac57\text{,}\) and \(x_3 = 1+\frac47 = \frac{11}{7}\text{.}\) Therefore,
\begin{equation*} R = \left(\frac{15}{7},\frac{5}{7},\frac{11}{7}\right) \end{equation*}
is the point on the line that is closest to \(Q\text{.}\)
The desired distance is therefore the distance from \(Q\) to \(R\text{,}\) which can be found using the distance formula:
\begin{align*} h \amp = \sqrt{\left(1-\frac{15}{7}\right)^2+\left(1-\frac{5}{7}\right)^2+\left(3-\frac{11}{7}^2\right)}\\ \amp = \sqrt{\left(-\frac87\right)^2+\left(\frac27\right)^2+\left(\frac{10}{7}\right)^2}\\ \amp =\frac17\sqrt{8^2+2^2+10^2}\\ \amp = \frac{\sqrt{168}}{7}=2\sqrt{\frac67}\text{.} \end{align*}
We summarize the steps involved to give the following general advice:

Key Idea 2.5.14. Steps for solving shortest distance problems.

Suppose you are asked to find the distance between two objects, or to determine an object (such as a point) that is closest to a given object (a line or plane). Your solution to the problem should always include the following steps:
  1. Make a list of all the information provided in the problem.
  2. Make a note of what quantities you’re asked to determine.
  3. Draw a diagram. Label all relevant points and vectors, including those you know, and those you want to find.
  4. Using your diagram as a reference, compute any unknown points or vectors.

Example 2.5.15. Finding the closest point on a line.

Find the distance from the point \(Q=(1,3,-2)\) to the line \(\vec\ell\) that passes through the point \(P=(2,0,-1)\) in the direction of \(\vec d = \bbm 1\\-1\\0\ebm\text{,}\) and find the point \(R\) on \(\vec\ell\) that is closest to \(Q\text{.}\)
Solution.
We’re given a point \(P\) on the line, along with a direction vector \(\vec d\text{,}\) and a point \(Q\) not on the line. We seek the point \(R\) on the line that is closest to \(Q\text{,}\) as well as the distance from \(Q\) to \(R\text{.}\) We begin by diagramming the information in Figure 2.5.16.
A horizontal line, on which points P and R are plotted. R is the point closest to another point Q.
A line \(\ell\) is drawn horizontally, although the direction of the line is not important. On the line, a point \(P\) is marked, and at that point, a direction vector \(\vec{d}\) is drawn. Another point \(Q\) is above the line, and the vector \(\overrightarrow{PQ}\) is drawn.
An additional point \(R\) is marked on the line \(\ell\text{,}\) so that the triangle \(PQR\) is a right-angled triangle. The height of this triangle (the distance from \(Q\) to \(R\)), is the distance from \(Q\) to the line.
Figure 2.5.16. Setting up the solution in Example 2.5.15
From the given points \(P\) and \(Q\) we can immediately construct the vector
\begin{equation*} \overrightarrow{PQ}=\bbm 1-2\\ 3-0\\ -2-(-1)\ebm = \bbm -1\\ 3\\ -1\ebm\text{.} \end{equation*}
We begin by finding the point \(R\) on the line that is closest to \(Q\text{.}\) From our diagram, we can see that the vector \(\overrightarrow{PR}\) from \(P\) to \(R\) is equal to the projection of \(\overrightarrow{PQ}\) onto the distance vector \(\vec{d}\text{:}\)
\begin{equation*} \overrightarrow{PR}=\operatorname{proj}_{\vec{d}}\overrightarrow{PQ}= \left(\frac{\bbm -1\\3\\-1\ebm\boldsymbol{\cdot}\bbm 1\\-1\\0\ebm}{\bbm 1\\-1\\0\ebm\boldsymbol{\cdot}\bbm 1\\-1\\0\ebm}\right)\bbm 1\\-1\\0\ebm = \bbm -2\\2\\0\ebm\text{.} \end{equation*}
Now, we need to pause and take care that we don’t make a very common mistake: the vector \(\overrightarrow{PR}\) does \textbf{not} give the coordinates of the point \(R\text{.}\) Instead, \(\overrightarrow{PR}\) tells us how to get from the point \(P\) to the point \(R\text{.}\) Letting \(O\) denote the origin, we can write \(\overrightarrow{OP}\) and \(\overrightarrow{OR}\) for the position vectors of \(P\) and \(R\text{,}\) respectively. Since \(\overrightarrow{PR} = \overrightarrow{OR}-\overrightarrow{OP}\) using the “tip minus tail” rule for computing the vector between two points, we have
\begin{equation*} \overrightarrow{OR} = \overrightarrow{OP}+\overrightarrow{PR} = \bbm 2\\ 0\\ -1\ebm + \bbm -2\\ 2\\ 0\ebm = \bbm 0\\ 2\\ -1\ebm\text{.} \end{equation*}
Thus, we have \(R=(0,2,-1)\) as the point on the line closest to the point \(Q\text{.}\) We can now find the distance from \(Q\) to the line using the distance formula:
\begin{equation*} D= \sqrt{(1-0)^2+(3-2)^2+(-2-(-1))^2} = \sqrt{3}\text{.} \end{equation*}
An alternative way of computing the distance is to make use of the orthogonal decomposition in Key Idea 2.3.19. By definition of the distance from a point to a line, we know that the vector \(\overrightarrow{RQ}\) must be orthogonal to the line, and thus to the direction vector \(\vec{d}\text{.}\) Using Key Idea 2.3.19, we have that
\begin{equation*} \overrightarrow{RQ}= \overrightarrow{PQ}-\overrightarrow{PR} = \bbm -1\\ 3\\ -1\ebm - \bbm -2\\ 2\\ 0\ebm = \bbm -1\\ 1\\ 1\ebm\text{,} \end{equation*}
and the shortest distance is given by \(\norm{\overrightarrow{RQ}}=\sqrt{3}\text{,}\) as before.
It is also useful to determine the distance between lines, which we define as the length of the shortest line segment that connects the two lines (an argument from geometry shows that this line segments is perpendicular to both lines). Let lines \(\vec\ell_1(t) = \vec p_1 + t\vec d_1\) and \(\vec\ell_2(t) = \vec p_2 + t\vec d_2\) be given, as shown in Figure 2.5.17. To find the direction orthogonal to both \(\vec d_1\) and \(\vec d_2\text{,}\) we take the cross product: \(\vec c = \vec d_1\times \vec d_2\text{.}\) The magnitude of the orthogonal projection of \(\overrightarrow{P_1P_2}\) onto \(\vec c\) is the distance \(h\) we seek:
\begin{align} h\amp = \norm{\operatorname{proj}_{\vec c}\overrightarrow{P_1P_2}} = \norm{\frac{\overrightarrow{P_1P_2}\cdot\vec c}{\dotp cc}\vec c}\tag{2.5.2}\\ \amp =\frac{\abs{\overrightarrow{P_1P_2}\cdot \vec c}}{\vnorm c^2}\vnorm c =\frac{\abs{\overrightarrow{P_1P_2}\cdot \vec c}}{\vnorm c}\text{.}\tag{2.5.3} \end{align}
Figure 2.5.17. Establishing the distance between lines
A problem in the exercises of this section is to show that this distance is 0 when the lines intersect. Note the use of the Triple Scalar Product: \(\overrightarrow{P_1P_2}\cdot \vec c = \overrightarrow{P_1P_2}\cdot (\vec d_1\times \vec d_2)\text{.}\)

Example 2.5.18. Finding the distance between lines.

Find the distance between the lines
\begin{equation*} \ell_1: \begin{matrix} x\amp =\amp 1+3t \\ y\amp =\amp 2-t\\z\amp =\amp t \end{matrix} \qquad\qquad \ell_2:\begin{matrix} x\amp =\amp -2+4s\\y\amp =\amp 3+s\\z\amp =\amp 5+2s. \end{matrix} \end{equation*}
Solution.
These are the sames lines as given in Example 2.5.8, where we showed them to be skew. The equations allow us to identify the following points and vectors:
\begin{equation*} P_1 = (1,2,0) P_2 = (-2,3,5) \Rightarrow \overrightarrow{P_1P_2} = \bbm -3\\1\\5\ebm\text{.} \end{equation*}
\begin{equation*} \vec d_1 = \bbm 3\\-1\\1\ebm \vec d_2 = \bbm 4\\1\\2\ebm \Rightarrow \vec c = \vec d_1\times \vec d_2 = \bbm -3\\-2\\7\ebm\text{.} \end{equation*}
Using Equation (2.5.3) we have the distance \(h\) between the two lines is
\begin{align*} h \amp = \frac{\abs{\overrightarrow{P_1P_2}\cdot \vec c}}{\vnorm c}\\ \amp =\frac{42}{\sqrt{62}} \approx 5.334\text{.} \end{align*}
The lines are approximately 5.334 units apart.
Once again, we do not recommend attempting to memorize Equation (2.5.3). Unless you somehow find yourself at a point in your life where you need to find the distances between a whole lot of pairs of skew lines, you will be better served by learning the skills required to set up and think through a problem than you will be by memorizing a formula to plug numbers into. In the case of skew lines, the key observation is that if we take the vector between any pair of points, one on each line, and project it onto the vector \(\vec c = \vec{d}_1\times\vec{d}_2\text{,}\) the length of the resulting vector is the distance we seek.
Somewhat more challenging is the problem of finding the points on each line that actually realize this shortest distance.

Example 2.5.19. Finding the closest points on skew lines.

Find the points \(R_1\) on \(\vec\ell_1\) and \(R_2\) on \(\vec\ell_2\text{,}\) where \(\vec\ell_1\) and \(\vec\ell_2\) are the lines from Example 2.5.18, such that the distance from \(R_1\) to \(R_2\) is a minimum.
Solution.
Since \(R_1\) is a point on \(\vec\ell_1\text{,}\) we know that
\begin{equation} R_1 = (1+3t, 2-t, t), \quad \text{ for some real number } t\text{,}\tag{2.5.4} \end{equation}
and similarly,
\begin{equation} R_2 = (-2+4s, 3+s, 5+2s), \quad \text{ for some real number } s\text{.}\tag{2.5.5} \end{equation}
The vector \(\overrightarrow{R_1R_2}\) is therefore given by
\begin{equation*} \overrightarrow{R_1R_2}=\bbm -3+4s-3t\\ 1+s+t\\ 5+2s-t\ebm\text{,} \end{equation*}
for some pair of real numbers \(s\) and \(t\text{.}\)
We know that the line segment \(\overline{R_1R_2}\) must be perpendicular to both \(\vec\ell_1\) and \(\vec\ell_2\) in order to minimize the distance, so the vector \(\overrightarrow{R_1R_2}\) must be orthogonal to both \(\vec{d}_1\) and \(\vec{d}_2\text{.}\) Thus,
\begin{align*} 0 = \vec{d}_1\boldsymbol{\cdot}\overrightarrow{R_1R_2} \amp = 3(-3+4s-3t)-1(1+s+t)+1(5+2s-t) \\ \amp =13s-11t-5, \text{ and}\\ 0 = \vec{d}_2\boldsymbol{\cdot}\overrightarrow{R_1R_2} \amp = 4(-3+4s-3t)+1(1+s+t)+2(5+2s-t)\\ \amp = 21s-13t-1\text{.} \end{align*}
We end up having to solve a system of two linear equations in the two variables, \(s\) and \(t\text{,}\) given by
\begin{equation*} \begin{array}{ccccc} 13s \amp - \amp 11t \amp = \amp 5\\ 21s \amp - \amp 13t \amp = \amp 1 \end{array}\text{.} \end{equation*}
You probably had to solve such systems in high school. One option is to solve graphically, by plotting the lines given by each equation, and seeing where they intersect. However, this method has little hope of providing an accurate answer. Instead, we try a little algebra.
Multiplying the first equation by 21 and the second by 13 gives us the equations \(273s-231t=105\) and \(273s-169t=13\text{,}\) respectively. Subtracting the second equation from the first, we have \(-62t = 92\text{,}\) so \(t=-\frac{92}{62}=-\frac{46}{31}\text{.}\) Plugging this value back into any of the previous equations gives us \(s=-\frac{351}{403}=-\frac{27}{31}\text{.}\) (We didn’t promise that the numbers would work out nicely!) Plugging these values back into equations (2.5.4) and (2.5.5), we find
\begin{equation*} R_1 = \left(-\frac{107}{31}, \frac{108}{31}, -\frac{46}{31}\right) \quad \text{ and } \quad R_2 = \left(-\frac{170}{31}, \frac{66}{31}, \frac{101}{31}\right)\text{.} \end{equation*}
Our vector \(\overrightarrow{R_1R_2}\) is then given by
\begin{equation*} \overrightarrow{R_1R_2} = \bbm -\frac{63}{31}\\ -\frac{42}{31}\\ \frac{147}{31}\ebm = \frac{1}{31}\bbm -63\\ -42\\ 147\ebm\text{,} \end{equation*}
and the distance between the two lines is given by
\begin{equation*} \norm{\overrightarrow{R_1R_2}} = \frac{1}{31}\sqrt{63^2+42^2+147^2} = \frac{42}{\sqrt{62}}, \end{equation*}
as before.
Example 2.5.19 required us to solve a system of two linear equations in two unknowns \(s\) and \(t\text{.}\) Although this involved some messy fractions, the algebra involved was fairly straightforward. In many real life problems it is necessary to be able to solve systems involving hundreds or even thousands of equations and variables. We will begin our study of how to systematically solve such systems in the next chapter.
One of the key points to understand from this section is this: to describe a line, we need a point and a direction. Whenever a problem is posed concerning a line, one needs to take whatever information is offered and glean point and direction information. Many questions can be asked (and are asked in the Exercise section) whose answer immediately follows from this understanding.
Lines are one of two fundamental objects of study in space. The other fundamental object is the plane, which we study in detail in the next section. Many complex three dimensional objects are studied by approximating their surfaces with lines and planes.

Exercises 2.5.4 Exercises

Exercise Group.

Write the vector, parametric and symmetric equations of the lines described.
1.
Passes through \(P=(2,-4,1)\text{,}\) parallel to \(\vec d=\bbm 9\\2\\5\ebm\text{.}\)
2.
\(\ell\) is a line that passes through \(P=(6,1,7)\text{,}\) parallel to \(\vec d=\bbm -3\\2\\5\ebm\text{.}\)
3.
Passes through \(P=(2,1,5)\) and \(Q = (7,-2,4)\text{.}\)
4.
\(\ell\) is a line that passes through \(P=(1,-2,3)\) and \(Q = (5,5,5)\text{.}\)
5.
Passes through \(P=(0,1,2)\) and orthogonal to both
\(\vec d_1=\bbm 2\\-1\\7\ebm\) and \(\vec d_2=\bbm 7\\1\\3\ebm\text{.}\)
6.
\(\ell\) is a line that passes through \(P=(5,1,9)\) and is orthogonal to both \(\vec d_1=\bbm 1\\0\\1\ebm\) and \(\vec d_2=\bbm 2\\0\\3\ebm\text{.}\)
7.
\(\ell\) is a line that passes through the intersection of \(\vec\ell_1(t)=\bbm 2\\1\\1\ebm+t\bbm 5\\1\\-2\ebm\) and \(\vec\ell_2(t)=\bbm -2\\-1\\2\ebm+t\bbm 3\\1\\-1\ebm\text{,}\) and is orthogonal to both lines.
8.
\(\ell\) is a line that passes through the intersection of \(\vec\ell_1(t)=\begin{cases}x\amp=t\\y\amp=-2+2t\\z\amp=1+t\end{cases}\) and \(\vec\ell_2(t)=\begin{cases}x\amp=2+t\\y\amp=2-t\\z\amp=3+2t\end{cases}\text{,}\) and is orthogonal to both lines.
9.
Passes through \(P=(1,1)\text{,}\) parallel to \(\vec d = \bbm 2\\3\ebm\text{.}\)
10.
\(\ell\) is a line that passes through \(P=(-2,5)\text{,}\) parallel to \(\vec d = \bbm 0\\1\ebm\text{.}\)

Exercise Group.

Determine if the described lines are the same line, parallel lines, intersecting or skew lines. If intersecting, give the point of intersection.
11.
\(\vec\ell_1(t) = \bbm 1\\2\\1\ebm + t\bbm 2\\-1\\1\ebm\) and \(\vec\ell_2(t) = \bbm 3\\3\\3\ebm + t\bbm -4\\2\\-2\ebm\text{.}\)
12.
\(\vec\ell_1(t) = \bbm 2\\1\\1\ebm + t\bbm 5\\1\\3\ebm\) and \(\vec\ell_2(t) = \bbm 14\\5\\9\ebm + t\bbm 1\\1\\1\ebm\text{.}\)
13.
\(\vec\ell_1(t) = \bbm 3\\4\\1\ebm + t\bbm 2\\-3\\4\ebm\text{,}\)
\(\vec\ell_2(t) = \bbm -3\\3\\-3\ebm + t\bbm 3\\-2\\4\ebm\text{.}\)
14.
\(\vec\ell_1(t) = \bbm 1\\1\\1\ebm + t\bbm 3\\1\\3\ebm\) and \(\vec\ell_2(t) = \bbm 7\\3\\7\ebm + t\bbm 6\\2\\6\ebm\text{.}\)
15.
\(\vec\ell_1(t) = \begin{cases}x\amp = 1+2t\\ y\amp = 3-2t\\ z\amp = t\end{cases}\) and \(\vec\ell_2(t) = \begin{cases}x\amp = 3-t\\ y\amp = 3+5t\\ z\amp = 2+7t\end{cases}\text{.}\)
16.
\(\vec\ell_1(t) = \begin{cases}x\amp = 1.1+0.6t\\ y\amp = 3.77+0.9t\\ z\amp = -2.3+1.5t\end{cases}\) and \(\vec\ell_2(t) = \begin{cases}x\amp = 3.11+3.4t\\ y\amp = 2+5.1t\\ z\amp = 2.5+8.5t\end{cases}\text{.}\)
17.
\(\ell_1 = \left\{\begin{aligned}x\amp = 0.2+0.6t\\ y\amp = 1.33-0.45t\\ z\amp = -4.2+1.05t \end{aligned} \right.\) and \(\ell_2 = \left\{\begin{aligned}x\amp = 0.86+9.2t\\ y\amp = 0.835-6.9t\\ z\amp = -3.045+16.1t \end{aligned} \right.\)
18.
\(\vec\ell_1(t) = \begin{cases}x\amp = 0.1+1.1t\\ y\amp = 2.9-1.5t\\ z\amp = 3.2+1.6t\end{cases}\) and \(\vec\ell_2(t) = \begin{cases}x\amp = 4-2.1t\\ y\amp = 1.8+7.2t\\ z\amp = 3.1+1.1t\end{cases}\text{.}\)

Exercise Group.

Find the distance from the point to the line.
19.
\(Q=(1,1,1)\text{,}\) \(\vec\ell(t) = \bbm 2\\1\\3\ebm + t\bbm 2\\1\\-2\ebm\)
20.
Find the distance from the point \(Q=(2,5,6)\) to the line \(\vec\ell(t) = \bbm -1\\1\\1\ebm + t\bbm 1\\0\\1\ebm\text{.}\)
21.
\(Q=(0,3)\text{,}\) \(\vec\ell(t) = \bbm 2\\0\ebm + t\bbm 1\\1\ebm\)
22.
Find the distance from the point \(Q=(1,1)\) to the line \(\vec\ell(t) = \bbm 4\\5\ebm + t\bbm -4\\3\ebm\text{.}\)

Exercise Group.

Find the distance between the two lines.
23.
\(\vec\ell_1(t) = \bbm 1\\2\\1\ebm + t\bbm 2\\-1\\1\ebm\text{,}\)
\(\vec\ell_2(t) = \bbm 3\\3\\3\ebm + t\bbm 4\\2\\-2\ebm\text{.}\)
24.
Find the distance between the line \(\vec\ell_1(t) = \bbm 0\\0\\1\ebm + t\bbm 1\\0\\0\ebm\) and the line \(\vec\ell_2(t) = \bbm 0\\0\\3\ebm + t\bbm 0\\1\\0\ebm\text{.}\)