# 3D Coordinate Geometry - Equation of a Line

## Equation of a Line

To find the equation of a line in a two-dimensional plane, we need to know a point that the line passes through as well as the slope. Similarly, in three-dimensional space, we can obtain the equation of a line if we know a point that the line passes through as well as the **direction vector**, which designates the direction of the line. The formula is as follows:

The equation of a line with direction vector \(\vec{d}=(l,m,n)\) that passes through the point \((x_1,y_1,z_1)\) is given by the formula

\[\frac{x-x_1}{l}=\frac{y-y_1}{m}=\frac{z-z_1}{n},\]

where \(l,m,\) and \(n\) are non-zero real numbers. \(_\square\)

Consider a line which passes through the point \(P=(x_1,y_1,z_1)\) and has direction vector \(\vec{d}=(l,m,n),\) where \(l,m,\) and \(n\) are non-zero real numbers. Let \(X=(x,y,z)\) be a random point on the line. Then the vector \(\vec{PX},\) which is the red arrow in the figure above, will be parallel to \(\vec{d}.\) Hence we have

\[\begin{align} \vec{PX}&=t\vec{d}\\ (x-x_1,y-y_1,z-z_1)&=t\cdot(l,m,n)\\ t&=\frac{x-x_1}{l}=\frac{y-y_1}{m}=\frac{z-z_1}{n}. \end{align}\]

Therefore, any point \(X=(x,y,z)\) on the line will satisfy the equation

\[\frac{x-x_1}{l}=\frac{y-y_1}{m}=\frac{z-z_1}{n}.\ _\square\]

Find the equation of a line with direction vector \(\vec{d}=(1,2,3)\) that passes through the point \(P=(-1,0,1).\)

According to the formula above, the equation of the line is

\[x+1=\frac{y}{2}=\frac{z-1}{3}.\ _\square\]

In similarity with a line on the coordinate plane, we can find the equation of a line in a three-dimensional space when given two different points on the line, since subtracting the position vectors of the two points will give the direction vector.

Find the equation of the line that passes through the points \(P=(3,-1,2)\) and \(Q=(-3,0,1).\)

Subtracting the position vectors of the two points gives the direction vector, which is

\[\vec{d}=\vec{PQ}=(-6,1,-1).\]

We can either set \(P\) or \(Q\) as \((x_1,y_1,z_1).\) Using \(P\) would give

\[\frac{x-3}{-6}=y+1=-(z-2),\qquad(1)\]

and using \(Q\) would give

\[\frac{x+3}{-6}=y=-(z-1).\qquad(2)\]

Observe that adding 1 to all sides of (2) gives (1), which means that both equations are identical. \( _\square \)

What if a coordinate of the direction vector equals zero? Suppose the \(x\)-coordinate of the direction vector is zero. This indicates that all points on the line would have equal \(x\)-coordinates. Hence the equation for this case would look like

\[\begin{align} \frac{y-y_1}{m}&=\frac{z-z_1}{n}\\ x&=x_1. \end{align}\]

Similarly, in the case where two coordinates of the direction vector are zero (say, the \(x\)- and \(y\)-coordinates), the equation would look like

\[\begin{align} x&=x_1\\ y&=y_1. \end{align}\]

Find the equation of the line that passes through the two points \(P=(1,1,1)\) and \(Q=(-1,1,3).\)

Subtracting the position vectors of the two points gives the direction vector, which is

\[\vec{d}=\vec{PQ}=(-2,0,2).\]

Since the \(y\)-coordinate of the direction vector is zero, the equation is

\[\begin{align} \frac{x-1}{-2}&=\frac{z-1}{2}\\ y&=1\\ \\ &\text{or}\\ \\ \frac{x+1}{-2}&=\frac{z-3}{2}\\ y&=1.\ _\square \end{align}\]

The relationship between two different lines in a three-dimensional space is always one of the three: they can be parallel, skew, or intersecting at one point. If the direction vectors of the lines are parallel, then the lines are also parallel (provided that they are not identical). If the lines do not meet and their direction vectors are not parallel, then they are skew. If the lines meet and their direction vectors are not parallel, then the lines meet at a single point. As we can see, comparing the direction vectors usually gives useful information concerning two lines.

What is the relationship of the following two lines:

\[\frac{x-2}{2}=y=\frac{z+1}{-3}\quad \text{and}\quad \frac{x+7}{-6}=-\frac{y}{3}=\frac{z+1}{9}?\]

The direction vectors of the two lines are \(\vec{d_1}=(2,1,-3)\) and \(\vec{d_2}=(-6,-3,9).\) Since \(-3\vec{d_1}=\vec{d_2},\) the two direction vectors are parallel. This implies that the two lines are either identical or parallel. A point that the first line passes through is \((2,0,-1).\) Since this point does not satisfy the equation of the second line, the second line does not pass through this point. Therefore, the two lines are parallel. \(_\square\)

## Examples and Problems

## See Also

**Cite as:**3D Coordinate Geometry - Equation of a Line.

*Brilliant.org*. Retrieved from https://brilliant.org/wiki/3d-coordinate-geometry-equation-of-a-line/