Skip to main content
\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)
[ "article:topic", "parametric equations of a line", "Parallel Line", "skew lines", "authorname:apex", "showtoc:no", "license:ccbync" ]
Mathematics LibreTexts

10.5: Lines

  • Page ID
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    To find the equation of a line in the \(x\)-\(y\) 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:

    \[\text{To define a line, one needs a point on the line and the direction of the line.}\]

    This holds true for 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\). 

    Clearly one point on the line is \(P\); 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\). For instance, starting at \(\vec p\) and traveling one length of \(\vec d\) places one at another point on the line. Consider Figure 10.47 where certain points along the line are indicated. 

    Figure 10.47: 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\). That is, we can define the line as a function of \(t\):
    \[\vec\ell(t) = \vec p + t \vec d.\label{eq:lines1}\]

    In many ways, this is not a new concept. Compare Equation \ref{eq:lines1} to the familiar "\(y=mx+b\)" equation of a line:

    Figure 10.46: 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.

    Equation \ref{eq:lines1} is an example of a vector-valued function; the input of the function is a real number and the output is a vector. We will cover vector--valued functions extensively in the next chapter.

    There are other ways to represent a line. Let \(\vec p = \langle x_0,y_0,z_0\rangle\) and let \(\vec d = \langle a,b,c\rangle\). Then the equation of the line through \(\vec p\) in the direction of \(\vec d\) is:
    \vec\ell(t) &= \vec p + t\vec d \\
    &= \langle x_0,y_0,z_0\rangle + t\langle a,b,c\rangle \\
    &= \langle x_0 + at, y_0+bt, z_0+ct\rangle.

    The last line states that the \(x\) values of the line are given by \(x=x_0+at\), the \(y\) values are given by \(y = y_0+bt\), and the \(z\) values are given by \(z = z_0 + ct\). These three equations, taken together, are the parametric equations of the line through \(\vec p\) in the direction of \(\vec d\).

    Finally, each of the equations for \(x\), \(y\) and \(z\) above contain the variable \(t\). We can solve for \(t\) in each equation:

    x = x_0+at \quad&\Rightarrow\quad t=\frac{x-x_0}{a},\\
    y=y_0+bt \quad&\Rightarrow\quad t = \frac{y-y_0}{b},\\
    z = z_0+ct \quad&\Rightarrow\quad t = \frac{z-z_0}{c},\\

    assuming \(a,b,c\neq 0\).

    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\):

    \[\frac{x-x_0}{a} = \frac{y-y_0}{b}=\frac{z-z_0}{c}.\]

    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 62 Equations of Lines in Space

    Consider the line in space that passes through \(\vec p = \langle x_0,y_0,z_0\rangle\) in the direction of \(\vec d = \langle a,b,c\rangle.\)

    1. The vector equation of the line is \[\vec \ell(t) = \vec p+t\vec d.\]
    2. The parametric equations of the line are
      \[x = x_0+at, \quad y=y_0+bt, \quad z = z_0+ct .\]
    3. The symmetric equations of the line are
      \[\frac{x-x_0}{a} = \frac{y-y_0}{b}=\frac{z-z_0}{c}.\]


    Example \(\PageIndex{1}\): Finding the equation of a line

    Give all three equations, as given in Definition 62, of the line through \(P = (2,3,1)\) in the direction of \(\vec d = \langle -1,1,2\rangle\). Does the point \(Q=(-1,6,6)\) lie on this line?

    We identify the point \(P=(2,3,1)\) with the vector \(\vec p =\langle 2,3,1\rangle\). Following the definition, we have

    1. the vector equation of the line is \(\vec\ell(t) = \langle 2,3,1\rangle + t\langle -1,1,2\rangle\);
    2. the parametric equations of the line are
      \[x = 2-t,\quad y = 3+t,\quad z = 1+2t; \text{ and}\]
    3. the symmetric equations of the line are
      \[\frac{x-2}{-1}=\frac{y-3}{1} = \frac{z-1}{2}.\]

    Figure 10.48: Graphing a line in Example 10.5.1. 

    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, to make Figure 10.48, a certain graphics program was given the input \(\texttt{(2-x,3+x,1+2*x)}\). This particular program requires the variable always be "\(x\)" instead of "\(t\)").

    Does the point \(Q = (-1,6,6)\) lie on the line? The graph in Figure 10.48 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\), \(y\) and \(z\) and see if equality is maintained:
    \[ \frac{-1-2}{-1} \stackrel{?}{=} \frac{6-3}{1} \stackrel{?}{=} \frac{6-1}{2} \quad \Rightarrow \quad 3=3\neq2.5.\]
    We see that \(Q\) does not lie on the line as it did not satisfy the symmetric equations.


    Example \(\PageIndex{2}\): 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)\).

    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\): \(\vec{PQ} = \langle -1,4,-3\rangle\).

    The parametric equations of the line \(\ell\) through \(P\) in the direction of \(\vec{PQ}\) are:
    \[\ell: \quad x= 2-t\quad y=-1+4t \quad z=2-3t.\]

    Figure 10.49: A graph of the line in Example 10.5.2. 

    A graph of the points and line are given in Figure 10.49. Note how in the given parametrization of the line, \(t=0\) corresponds to the point \(P\), and \(t=1\) corresponds to the point \(Q\). This relates to the understanding of the vector equation of a line described in Figure 10.46. The parametric equations "start'' at the point \(P\), and \(t\) determines how far in the direction of \(\vec{PQ}\) to travel. When \(t=0\), we travel 0 lengths of \(\vec{PQ}\); when \(t=1\), we travel one length of \(\vec{PQ}\), resulting in the point \(Q\).

    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\), we have four possibilities: \(\vec \ell_1\) and \(\vec \ell_2\) are


    The next two examples investigate these possibilities.

    Example \(\PageIndex{3}\): Comparing lines

     Consider lines \(\ell_1\) and \(\ell_2\), given in parametric equation form:
    \[\ell_1: \begin{array}{ccc} x&=&1+3t \\ y&=&2-t\\z&=&t\end{array}\qquad\qquad \ell_2:\begin{array}{ccc} x&=&-2+4s\\y&=&3+s\\z&=&5+2s.\end{array}\]
    Determine whether \(\ell_1\) and \(\ell_2\) are the same line, intersect, are parallel, or skew.


    We start by looking at the directions of each line. Line \(\ell_1\) has the direction given by \(\vec d_1=\langle 3,-1,1\rangle\) and line \(\ell_2\) has the direction given by \(\vec d_2 = \langle 4,1,2\rangle\). 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 10.50 verifies this fact (where the points and directions indicated by the equations of each line are identified).

    Figure 10.50: Sketching the lines from Example 10.5.3

    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\), \(y\) and \(z\) values are the same. That is, we want \(s\) and \(t\) such that:

    1+3t &=&-2+4s\\

    This is a relatively simple system of linear equations. Since the last equation is already solved for \(t\), substitute that value of \(t\) into the equation above it:

    \[2-(5+2s) = 3+s \quad \Rightarrow \quad s=-2,\ t=1.\]

    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:

    \[1+3(1) \neq -2+4(-2).\]

    It does not. Therefore, we conclude that the lines \(\ell_1\) and \(\ell_2\) are skew.


    Example \(\PageIndex{4}\): Comparing lines

    Consider lines \(\ell_1\) and \(\ell_2\), given in parametric equation form:

    \[\ell_1: \begin{array}{ccc} x&=&-0.7+1.6t \\ y&=&4.2+2.72t\\z&=&2.3-3.36t\end{array}\qquad\qquad \ell_2:\begin{array}{ccc} x&=&2.8-2.9s\\y&=&10.15-4.93s\\z&=&-5.05+6.09s.\end{array}\]

    Determine whether \(\ell_1\) and \(\ell_2\) are the same line, intersect, are parallel, or skew.

    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 = \langle 1.6,2.72,-3.36\rangle\) and the direction of \(\ell_2\) is given by \(\vec d_2 = \langle -2.9,-4.93,6.09\rangle\). 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:

    \vec u_1 &= \frac{\vec d_1}{\norm{\vec d_1}} = \langle 0.3471,0.5901,-0.7289\rangle\\
     \vec u_2 &= \frac{\vec d_2}{\norm{\vec d_2}} = \langle -0.3471,-0.5901,0.7289\rangle.

    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 

    \[\vec d_1 =\langle \frac{16}{10},\frac{272}{100},-\frac{336}{100}\rangle \qquad \vec d_2 = \langle -\frac{29}{10},-\frac{493}{100},\frac{609}{100}\rangle.\]

    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 

    \[\vec u_1 = \langle \sqrt{\frac{10}{83}},\frac{17}{\sqrt{830}},-\frac{21}{\sqrt{830}}\rangle \qquad \vec u_2 = \langle -\sqrt{\frac{10}{83}},-\frac{17}{\sqrt{830}},\frac{21}{\sqrt{830}}\rangle.\]

    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\). To determine if this point also lies on \(\ell_2\), plug in the \(x\), \(y\) and \(z\) values of \(P_1\) into the symmetric equations for \(\ell_2\):
    \[\frac{(-0.7)-2.8}{-2.9} \stackrel{?}{=} \frac{(4.2)-10.15}{-4.93} \stackrel{?}{=} \frac{(2.3)-(-5.05)}{6.09} \quad \Rightarrow \quad 1.2069=1.2069=1.2069.\]

    Figure 10.51: Graphing the lines in Example 10.5.4

    The point \(P_1\) lies on both lines, so we conclude they are the same line, just parametrized differently. Figure 10.51 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). 


    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\), Figure 10.52 will help establish a general method of computing this distance \(h\).

    Figure 10.52: Establishing the distance from a point to a line.

    From trigonometry, we know \(h = \norm{\vec{PQ}}\sin\theta\). We have a similar identity involving the cross product: \(\norm{\vec{PQ}\times \vec d} = \norm{\vec{PQ}}\, \norm{d}\sin\theta.\) Divide both sides of this latter equation by \(\norm{d}\) to obtain \(h\):

    \[h = \frac{\norm{\vec{PQ}\times \vec d}}{\norm{d}}.\label{eq:lines2}\]

    Figure 10.53: Establishing the distance between lines.

    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 10.53. To find the direction orthogonal to both \(\vec d_1\) and \(\vec d_2\), we take the cross product: \(\vec c = \vec d_1\times \vec d_2\). The magnitude of the orthogonal projection of \(\vec{P_1P_2}\) onto \(\vec c\) is the distance \(h\) we seek:

    h&= \norm{\text{proj}\,_{\vec c}\,\vec{P_1P_2}}\\
    &= \norm{\frac{\vec{P_1P_2}\cdot\vec c}{\vec c \cdot \vec c}\vec c}\\
    &=\frac{|\vec{P_1P_2}\cdot \vec c|}{\norm c^2}\norm c\\
    &=\frac{|\vec{P_1P_2}\cdot \vec c|}{\norm c}.

    A problem in the Exercise section is to show that this distance is 0 when the lines intersect. Note the use of the Triple Scalar Product: \(\vec{P_1P_2}\cdot c = \vec{P_1P_2}\cdot (\vec d_1\times \vec d_2).\)

    The following Key Idea restates these two distance formulas.


    1. Let \(P\) be a point on a line \(\ell\) that is parallel to \(\vec d\). The distance \(h\) from a point \(Q\) to the line \(\ell\) is:
      \[h =\frac{\norm{\vec{PQ}\times \vec d}}{\norm{d}}.\]
    2. Let \(P_1\) be a point on line \(\ell_1\) that is parallel to \(\vec d_1\), and let \(P_2\) be a point on line \(\ell_2\) parallel to \(\vec d_2\), and let \(\vec c = \vec d_1\times \vec d_2\), where lines \(\ell_1\) and \(\ell_2\) are not parallel. The distance \(h\) between the two lines is:
      \[h=\frac{|\vec{P_1P_2}\cdot \vec c|}{\norm c}.\]


    Example \(\PageIndex{5}\): 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) = \langle 1,-1,1\rangle+t\langle 2,3,1\rangle.\)

    The equation of the line gives us the point \(P=(1,-1,1)\) that lies on the line, hence \(\vec{PQ} = \langle 0,2,2\rangle\). The equation also gives \(\vec d= \langle 2,3,1\rangle\). Following Key Idea 50, we have the distance as 
    h &= \frac{\norm{\vec{PQ}\times \vec d}}{\norm{d}}\\
    &= \frac{\norm{\langle -4,4,-4\rangle}}{\sqrt{14}}\\
    &=\frac{4\sqrt{3}}{\sqrt{14}} \approx 1.852.
    The point \(Q\) is approximately \(1.852\) units from the line \(\vec\ell(t)\).


    Example \(\PageIndex{6}\): Finding the distance between lines

    Find the distance between the lines \[\ell_1: \begin{array}{ccc} x&=&1+3t \\ y&=&2-t\\z&=&t\end{array}\qquad\qquad \ell_2:\begin{array}{ccc} x&=&-2+4s\\y&=&3+s\\z&=&5+2s.\end{array}\]

    These are the sames lines as given in Example 10.5.3, where we showed them to be skew. The equations allow us to identify the following points and vectors:

    \[P_1 = (1,2,0)\quad P_2 = (-2,3,5) \quad \Rightarrow \quad \vec{P_1P_2} = \langle -3,1,5\rangle.\]

    \[\vec d_1 = \langle 3,-1,1\rangle \quad \vec d_2 = \langle 4,1,2\rangle \quad \Rightarrow \quad \vec c = \vec d_1\times \vec d_2 = \langle -3,-2,7\rangle.\]

    From Key Idea 50 we have the distance \(h\) between the two lines is

    h &= \frac{|\vec{P_1P_2}\cdot \vec c|}{\norm c}\\
    &=\frac{42}{\sqrt{62}} \approx 5.334.

    The lines are approximately 5.334 units apart.

    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.