Skip to main content

Equation of a line in 3D

Three vectors. Vector r extends from the origin to point capital R. Vector P zero extends from the origin to point capital P zero. A line connects points capital P zero and capital R and is given by the vector V. The equation for the line of vector r is vector P zero plus t times vector V.

Uniquely defining a line for a vector in three-dimensional space is useful in a range of scenarios. In mechanical and civil engineering, they are needed to create models and analyse alignment. In computer graphics, they can be used to define paths for animations. In physics, they represent trajectories of particles and forces.

You should already know that a line in the \(x\)—\(y\) plane can be represented in the form \(y=mx+c\) where \(m\) is the gradient (or slope) of the line and \(c\) is the \(y\)-intercept. But how do we uniquely define a line in three dimensions (3D), where we need a third coordinate?

We can define lines in 3D in three different ways:

  • the vector equation
  • the parametric equation
  • the symmetric equation.

Vector equation of a line in 3D

The vector equation of a line is expressed using a position vector and a direction vector.

Consider the following figure.

Four vectors. Vector r1 extends from the origin to point capital R1. Vector r2 extends from the origin to point capital R2. A line connects points capital R1 and capital R2 and is given by the vector V. Vector P zero extends from the origin to point capital P zero, which sits on the line.
Here:

  • Two vectors \(\vec{r_{1}}\) and \(\vec{r_{2}}\) point from the origin \(O\) to the points \(R_{1}\) and \(R_{2}\), respectively.
  • The line is drawn such that it intersects points \(R_{1}\) and \(R_{2}\).
  • \(\vec{V}\) is a vector along the line. It is the direction vector.
  • \(P_{0}\) is a point on the line, with \(\vec{P_{0}}\) being its position vector—that is, \(\vec{P_{0}}\) tells us where point \(P_{0}\) is relative to the origin \(O\).

The equation of the line, written in vector form, is:

\[\vec{r}=\vec{P_{0}}+t\vec{V}\]

where \(t\) is a constant, or \(t\in\mathbb{R}\).

What this means is that to get to any point \(\vec{r}\) along the line, we need to first get to the line by travelling along \(\vec{P_{0}}\). Then, we travel a distance \(t\) along the line in the direction of \(\vec{V}\).

  • To get from \(O\) to \(R_{1}\), we travel along \(\vec{P_{0}}\), then we travel a distance along \(\vec{V}\) given by \(\vec{r_{1}}=\vec{P_{0}}+t\vec{V}\) where \(t\) is a positive constant.
  • To get from \(O\) to \(R_{2}\), we travel along \(\vec{P_{0}}\), then we travel a distance along \(\vec{V}\) given by \(\vec{r_{2}}=\vec{P_{0}}+t\vec{V}\) where \(t\) is a negative constant.

The positive or negative \(t\) indicates the direction we are travelling in, relative to \(\vec{V}\).

Parametric equation of a line in 3D

Lines can broken down into their components and expressed using parametric equations. These equations indicate the coordinates of any point on the line as functions of the parameter \(t\), hence, "parametric".

Since there are three axes in 3D, we define three separate parametric equations.

Let's look at the following figure.

Three vectors. The first vector extends from the origin to point P which has the coordinates, x, y and z. The second vector extends from the origin to point P zero which has coordinates, x zero, y zero and z zero. A line connects points capital P and P zero and is given by the vector V, which is a times i hat plus b times j hat plus c times k hat.
Suppose we wish to find the line that goes through the point \(P_{0}(x_{0},y_{0},z_{0})\) in the direction of the vector \(\vec{V}=a\hat{i}+b\hat{j}+c\hat{k}\). A general point \(P(x,y,z)\) lies on the line.

We can define vector \(\overrightarrow{P_{0}P}\) using:
\[\overrightarrow{P_{0}P} = (x-x_{0})\hat{i}+(y-y_{0})\hat{j}+(z-z_{0})\hat{k}\]
This vector will be in the same direction as \(\vec{V}\) but will likely have a different magnitude. In other words, \(\overrightarrow{P_{0}P}\) will be a multiple of the direction vector \(\vec{V}\). So \(\overrightarrow{P_{0}P}=t\vec{V}\) where \(t\in\mathbb{R}\).

We can substitute \(\vec{V}\) into this equation to get:
\[\begin{align*} \overrightarrow{P_{0}P} & = t\vec{V}\\
& = t\left(a\hat{i}+b\vec{j}+c\vec{k}\right)\\
& = at\hat{i}+bt\hat{j}+ct\hat{k}
\end{align*}\] We can equate the components of this equation with the earlier one to get three parametric equations:

\[\begin{align*} \left(x-x_{0}\right) & = at\\
x & = x_{0}+at
\end{align*}\] \[\begin{align*} \left(y-y_{0}\right) & = bt\\
y & = y_{0}+bt
\end{align*}\] \[\begin{align*} \left(z-z_{0}\right) & = ct\\
z & = z_{0}+ct
\end{align*}\]

These are parametric equations of the line that contains the point \((x_{0},y_{0},z_{0})\) and has the direction vector \(\vec{V}=a\hat{i}+b\hat{j}+c\hat{k}\). The variable \(t\in\mathbb{R}\) is called a parameter.

Symmetric equation of a line in 3D

The symmetric equation eliminates the parameter \(t\) by solving the parametric equations for \(t\). This helps identifying points on a line without expressing it in terms of a parameter.

We start by rearranging the parametric equations so that \(t\) is the subject.
\[\begin{align*} t = \frac{x-x_{0}}{a}\quad t=\frac{y-y_{0}}{b}\quad t=\frac{z-z_{0}}{c} \end{align*}\]

You might like to review rearranging (or transposing) algebraic formulas.

Since they are all equal, we can say that:

\[\frac{x-x_{0}}{a} = \frac{y-y_{0}}{b} = \frac{z-z_{0}}{c}\]

The equation is symmetric in the sense that each coordinate is treated in a similar manner, highlighting the proportional relationships along the line.

Example 1 – finding equations of a line in 3D

Find the parametric and symmetric equations of the line that goes through the point \((3,2,3)\) and is in the direction of the vector \(2\hat{i}+\hat{j}-5\hat{k}\).
First, we can define the variables. The point is written in the form \((x_{0},y_{0},z_{0})\), so \(x=3\), \(y=2\) and \(z=3\). The vector is written in the form \(a\hat{i}+b\hat{j}+c\hat{k}\), so \(a=2\), \(b=1\) and \(c=-5\).

We can now substitute them into the equations to form the parametric equations.
\[\begin{align*} x & = x_{0}+at\\
& = 3+2t
\end{align*}\] \[\begin{align*} y & = y_{0}+bt\\
& = 2+t
\end{align*}\] \[\begin{align*} z & = z_{0}+ct\\
& = 3-5t
\end{align*}\]

To get the symmetric equation, we substitute them into the relevant equation.
\[\begin{align*} & \frac{x-x_{0}}{a} = \frac{y-y_{0}}{b} = \frac{z-z_{0}}{c}\\
\Rightarrow & \quad \frac{x-3}{2} = \frac{y-2}{1} = \frac{z-3}{-5}\\
\Rightarrow & \quad \frac{x-3}{2} = y-2 = \frac{z-3}{-5}
\end{align*}\]

Find the parametric and symmetric equations of the line that goes through the point \((1,3,2)\) in the direction of the vector \(\vec{V}=\hat{j}-2\hat{k}\).

Here, \(x_{0}=1\), \(y_{0}=3\), \(z_{0}=2\), \(a=0\), \(b=1\) and \(c=-2\). Thus, the parametric equations will be:
\[\begin{align*} x & = 1+0t\\
& = 1 \end{align*}\] \[y=3+1t\] \[z=2-2t\]

The symmetric equation will be:
\[\begin{align*} & x = 1 ;\, y-3=\frac{z-2}{-2}\\
\Rightarrow & \quad x = 1 ;\, y-3=-\frac{1}{2}z+1
\end{align*}\]

Find the direction vector of the line \(\dfrac{x-6}{2} = \dfrac{y-2}{-1} = \dfrac{z}{3}\).

The line is in symmetric form, so we can separate it out into components:
\[\frac{x-6}{2} = t\] \[\frac{y-2}{-1} = t\] \[\frac{z}{3} = t\] where \(t\in\mathbb{R}\).

These can be rearranged to give the parametric equations, in terms of \(x\), \(y\) and \(z\).
\[x=6+2t\] \[y=2-t\] \[z=3t\]

Finally, This may be written in vector form.
\[x\hat{i}+y\hat{j}+z\hat{k} = (6\hat{i}+2\hat{j}+0\hat{k})+t(2\hat{i}-\hat{j}+3\hat{k}) \]

This is a line through the point \((6,2,0)\) in the direction \((2\hat{i}-\hat{j}+3\hat{k})\).

Hence, the direction vector is \(\overrightarrow{V}=2\hat{i}-\hat{j}+3\hat{k}\). The direction vector of the line could be any multiple of this vector, such as \(4\hat{i}-2\hat{j}+6\hat{k}\).

A line passes through the points \(A(1,2,4)\) and \(B(3,-1,-2)\). Find the equation of the line in:

  1. vector form
  2. parametric form
  3. symmetric form.

For part a, we need to find the vector along the line. Here, we will find vector \(\overrightarrow{AB}\) but it is also valid to find \(\overrightarrow{BA}\).
\[\begin{align*} \overrightarrow{AB} & = (x_{B}-x_{A})\hat{i}+(y_{B}-y_{A})\hat{j}+(z_{B}-z_{A})\hat{k}\\
& = (3-1)\hat{i}+(-1-2)\hat{j}+(-2-4)\hat{k}\\
& = 2\hat{i}-3\hat{j}-6\hat{k}
\end{align*}\]

Vector \(\overrightarrow{AB}\) is the direction vector along the line. We can now use either point \(A\) or \(B\) to find the equation of the line in vector form. Let's use point \(A\).
\[\vec{r}=(\hat{i}+2\hat{j}+4\hat{k})+t(2\hat{i}-3\hat{j}-6\hat{k})\]
where \(t\in\mathbb{R}\). This is the vector form of the line.

For part b, we equate the components to find \(x\), \(y\) and \(z\) in terms of \(t\).
\[\begin{align*} \vec{r} & = (1\hat{i}+2\hat{j}+4\hat{k})+t(2\hat{i}-3\hat{j}-6\hat{k})\\
x\hat{i}+y\hat{j}+z\hat{k} & = (1\hat{i}+2\hat{j}+4\hat{k})+t(2\hat{i}-3\hat{j}-6\hat{k})
\end{align*}\]

So:
\[x=1+2t\] \[y=2-3t\] \[z=4-6t\]

These are the parametric equations.
For part c, we solve the parametric equations for \(t\). First, rearranging them to make \(t\) the subject:
\[t=\frac{x-1}{2}\] \[t=\frac{2-y}{3}\] \[t=\frac{4-z}{6}\]

We can equate them to form the symmetric equation:
\[\frac{x-1}{2} = \frac{2-y}{3} = \frac{4-z}{6}\]

Exercise – finding equations of a line in 3D

Find the symmetric and parametric equations of the lines that satisfy the given conditions.

  1. contains the point \((1,-1,2)\) with the direction vector \(2\hat{i}-2\hat{j}+3\hat{k}\)
  2. contains the point \((3,4,-1)\) with the direction vector \(\hat{i}+\hat{j}+5\hat{k}\)
  3. contains the point \((2,3,-1)\) parallel to \(\dfrac{x-1}{2}=\dfrac{y-3}{-1}=\dfrac{x+1}{3}\)
  4. contains the points \((2,2,1)\) and \((1,1,3)\).

  1. Parametric equations: \(x=1+2t\), \(y=-1-2t\) and \(z=2+3t\)
    Symmetric equation: \(\dfrac{x-1}{2}=\dfrac{y+1}{-2}=\dfrac{z-2}{3}\)
  2. Parametric equations: \(x=3+t\), \(y=4+t\) and \(z=5t-1\)
    Symmetric equation: \(\dfrac{x-3}{1}=\dfrac{y-4}{1}=\dfrac{z+1}{5}\)
  3. Parametric equations: \(x=2+2t\), \(y=3-t\) and \(z=-1+3t\)
    Symmetric equation: \(\dfrac{x-2}{2}=\dfrac{y-3}{-1}=\dfrac{z+1}{3}\)
  4. Parametric equations: \(x=1+t\), \(y=1+t\) and \(z=3-2t\)
    Symmetric equation: \(\dfrac{x-1}{1}=\dfrac{y-1}{1}=\dfrac{z-3}{-2}\); or
    Parametric equations: \(x=2+t\), \(y=2+t\) and \(z=1-2t\)
    Symmetric equation: \(\dfrac{x-2}{1}=\dfrac{y-2}{1}=\dfrac{z-1}{-2}\)

Images on this page by RMIT, licensed under CC BY-NC 4.0