Analytic geometry · Space

The Line in Space

In the plane, one equation \(y = kx + b\) describes a line. In space a single linear equation describes a plane, so a line needs more. There are two natural ways to pin it down: by a point and a direction (and then the line is the path of a point moving with constant velocity), or as the intersection of two planes. This post covers both, shows how to switch between them, and collects the standard problems about angles, intersections and distances.

1. A point and a direction

Through a point \(M_1(x_1, y_1, z_1)\) passes exactly one line parallel to a given nonzero vector \( \vec p = \{l, m, n\} \), called a direction vector of the line. A point \(M(x, y, z)\) lies on this line exactly when the vector \( \overrightarrow{M_1M} = \vec r - \vec r_1 \) is parallel to \(\vec p\). Everything below is a different way of writing "parallel".

x y z O M₁(x₁, y₁, z₁) M(x, y, z) r₁ r r − r₁ p = {l, m, n}
Figure 1. The line through \(M_1\) with direction vector \(\vec p\). For a point \(M\) on the line, \( \vec r - \vec r_1 = \overrightarrow{M_1M} \) is parallel to \(\vec p\), i.e. \( \vec r = \vec r_1 + t\vec p \) for some number \(t\).

2. Three forms of the equation

1° Equations of a line through \(M_1(x_1, y_1, z_1)\) parallel to \(\vec p = \{l, m, n\}\)

1) Vector form: parallel vectors have zero cross product, so \[ (\vec r - \vec r_1)\times\vec p = \vec 0 \qquad\text{or}\qquad \vec r\times\vec p = \vec q, \quad \vec q = \vec r_1\times\vec p. \]

2) Canonical (symmetric) form: parallel vectors have proportional components, so \[ \frac{x - x_1}{l} = \frac{y - y_1}{m} = \frac{z - z_1}{n}. \]

3) Parametric form: calling the common ratio \(t\), \[ x = x_1 + lt, \qquad y = y_1 + mt, \qquad z = z_1 + nt. \]

How the forms relate. The parametric form is the vector equation \( \vec r = \vec r_1 + t\vec p \) written in components: start at \(M_1\) and move \(t\) times the vector \(\vec p\). If \(t\) is time, the point moves along the line with constant velocity \(\vec p\). Eliminating \(t\) (each coordinate gives \( t = \frac{x - x_1}{l} \), etc.) gives the canonical form, which is really two equations (hence "double equation"): two planes whose intersection is the line.

About the vector \(\vec q\). In \( \vec r\times\vec p = \vec q \), the vector \( \vec q = \vec r_1\times\vec p \) does not depend on which point \(M_1\) of the line we use (changing \(\vec r_1\) by a multiple of \(\vec p\) does not change the cross product). It is always perpendicular to \(\vec p\), and its length gives the distance of the line from the origin: \( d_O = \frac{|\vec q|}{|\vec p|} \).

Zeros in the denominators The canonical form is allowed to have a zero denominator, e.g. \( \frac{x - 1}{2} = \frac{y + 2}{0} = \frac{z - 3}{1} \). It is not a division by zero: it means the direction has no \(y\)-component, so \(y\) stays constant, \(y = -2\). Read "\(\frac{a}{0}\)" as "the numerator is zero". The parametric form never has this issue.
Example 1 The line through \(M_1(1, -2, 3)\) with direction \( \vec p = \{2, 1, -1\} \): \[ \frac{x - 1}{2} = \frac{y + 2}{1} = \frac{z - 3}{-1}; \qquad x = 1 + 2t,\ y = -2 + t,\ z = 3 - t. \] In vector form: \( \vec q = \vec r_1\times\vec p = \{1, -2, 3\}\times\{2, 1, -1\} = \{-1, 7, 5\} \), and \( \vec r\times\{2, 1, -1\} = \{-1, 7, 5\} \). Check: \( \vec q\cdot\vec p = -2 + 7 - 5 = 0 \). The line's distance from the origin is \( \frac{\sqrt{75}}{\sqrt6} \approx 3.54 \).
Example 2 · Line through two points Through \(A(1, 0, 2)\) and \(B(3, -1, 5)\): take \( \vec p = \overrightarrow{AB} = \{2, -1, 3\} \) and \(M_1 = A\): \[ \frac{x - 1}{2} = \frac{y}{-1} = \frac{z - 2}{3}. \] In general, \( \frac{x - x_1}{x_2 - x_1} = \frac{y - y_1}{y_2 - y_1} = \frac{z - z_1}{z_2 - z_1} \).

3. The line as an intersection of two planes

2° General equations of a line A line given as the intersection of two planes has the equations \[ \begin{cases} A_1x + B_1y + C_1z + D_1 = 0,\\ A_2x + B_2y + C_2z + D_2 = 0,\end{cases} \] provided the planes are not parallel (their normals \(\vec N_1\), \(\vec N_2\) are not proportional).

To use the formulas of Sections 4–6 we need a point and a direction. The line lies in both planes, so its direction is perpendicular to both normals:

\[ \vec p = \vec N_1\times\vec N_2. \]

For a point, fix one coordinate (often \(z = 0\)) and solve the remaining \(2\times2\) system. (If that system has no solution, the line is parallel to the plane \(z = 0\); fix another coordinate instead.)

Example 3 · From two planes to canonical form \( x + y + z - 6 = 0 \), \( x - y + 2z - 5 = 0 \).
  • Direction: \( \vec p = \{1, 1, 1\}\times\{1, -1, 2\} = \{3, -1, -2\} \).
  • Point: with \(z = 0\): \( x + y = 6 \), \( x - y = 5 \), so \( x = 5.5 \), \( y = 0.5 \).
\[ \frac{x - 5.5}{3} = \frac{y - 0.5}{-1} = \frac{z}{-2}. \] Conversely, the canonical form can always be turned back into two planes, e.g. \( \frac{x - 5.5}{3} = \frac{y - 0.5}{-1} \) and \( \frac{y - 0.5}{-1} = \frac{z}{-2} \).

A line has infinitely many pairs of planes through it (every pair from the pencil of planes through the line), so its general equations are far from unique. The canonical form is not unique either (any point, any multiple of \(\vec p\)), but the line itself is.

4. Angles: line and line, line and plane

Angles between lines are angles between their direction vectors:

\[ \cos\varphi = \frac{|\vec p_1\cdot\vec p_2|}{|\vec p_1|\,|\vec p_2|} = \frac{|l_1l_2 + m_1m_2 + n_1n_2|}{\sqrt{l_1^2 + m_1^2 + n_1^2}\sqrt{l_2^2 + m_2^2 + n_2^2}}. \]

This works even for skew lines (lines that neither meet nor are parallel); the angle is then measured after moving one line parallel to itself until they meet.

The angle \(\psi\) between a line and a plane is the angle between the line and its projection onto the plane. It is the complement of the angle between \(\vec p\) and the normal \(\vec N\), so the cosine turns into a sine:

\[ \sin\psi = \frac{|\vec N\cdot\vec p|}{|\vec N|\,|\vec p|} = \frac{|Al + Bm + Cn|}{\sqrt{A^2 + B^2 + C^2}\sqrt{l^2 + m^2 + n^2}}. \]
Example 4 The lines with directions \( \{2, 1, -1\} \) and \( \{1, -1, 2\} \): \( \cos\varphi = \frac{|2 - 1 - 2|}{\sqrt6\sqrt6} = \frac16 \), \( \varphi \approx 80.4^\circ \).
The line of Example 1 and the plane \( x + y + z = 6 \): \( \sin\psi = \frac{|2 + 1 - 1|}{\sqrt3\sqrt6} = \frac{2}{\sqrt{18}} \approx 0.471 \), \( \psi \approx 28.1^\circ \).

5. Where a line meets a plane

The parametric form makes this easy: substitute \( x = x_1 + lt \), \( y = y_1 + mt \), \( z = z_1 + nt \) into the plane's equation. This gives one linear equation for \(t\):

\[ (Al + Bm + Cn)\,t + (Ax_1 + By_1 + Cz_1 + D) = 0. \]
Example 5 The line of Example 1 and the plane \( x + y + z = 6 \): \( (1 + 2t) + (-2 + t) + (3 - t) = 6 \), so \( 2 + 2t = 6 \), \( t = 2 \). The intersection point is \( (5, 0, 1) \).

6. Distances

From a point to a line

The vectors \( \overrightarrow{M_1M_0} \) and \(\vec p\) span a parallelogram whose area is \( |\overrightarrow{M_1M_0}\times\vec p| \). Its base is \(|\vec p|\) and its height is exactly the distance from \(M_0\) to the line:

\[ d = \frac{|\overrightarrow{M_1M_0}\times\vec p|}{|\vec p|}. \]
Example 6 The distance from \(M_0(1, 1, 1)\) to the line of Example 1: \( \overrightarrow{M_1M_0} = \{0, 3, -2\} \), \( \{0, 3, -2\}\times\{2, 1, -1\} = \{-1, -4, -6\} \), so \[ d = \frac{\sqrt{1 + 16 + 36}}{\sqrt6} = \sqrt{\frac{53}{6}} \approx 2.97. \]

Between two skew lines

Let the lines pass through \(M_1\), \(M_2\) with directions \(\vec p_1\), \(\vec p_2\). The vector \( \vec p_1\times\vec p_2 \) is perpendicular to both lines, so the shortest distance is the projection of \( \overrightarrow{M_1M_2} \) onto it:

\[ d = \frac{\big|\overrightarrow{M_1M_2}\cdot(\vec p_1\times\vec p_2)\big|}{|\vec p_1\times\vec p_2|}. \]

The numerator is the absolute value of a mixed (triple) product. If it is zero, the two lines are coplanar (they intersect or are parallel); this is the test for whether two lines meet.

Example 7 \(L_1\): through \(O(0, 0, 0)\), \( \vec p_1 = \{1, 1, 0\} \); \(L_2\): through \(M_2(1, 0, 2)\), \( \vec p_2 = \{0, 1, 1\} \). Then \( \vec p_1\times\vec p_2 = \{1, -1, 1\} \) and \[ d = \frac{|\{1, 0, 2\}\cdot\{1, -1, 1\}|}{\sqrt3} = \frac{3}{\sqrt3} = \sqrt3. \] The lines are skew (the mixed product \(3 \ne 0\)).

7. Summary

ConceptFormula
Vector form\( (\vec r - \vec r_1)\times\vec p = \vec 0 \); \( \vec r\times\vec p = \vec q \)
Canonical form\( \frac{x - x_1}{l} = \frac{y - y_1}{m} = \frac{z - z_1}{n} \)
Parametric form\( x = x_1 + lt,\ y = y_1 + mt,\ z = z_1 + nt \)
Intersection of planesdirection \( \vec p = \vec N_1\times\vec N_2 \)
Angle between lines\( \cos\varphi = \frac{|\vec p_1\cdot\vec p_2|}{|\vec p_1||\vec p_2|} \)
Angle line–plane\( \sin\psi = \frac{|\vec N\cdot\vec p|}{|\vec N||\vec p|} \)
Point to line\( d = \frac{|\overrightarrow{M_1M_0}\times\vec p|}{|\vec p|} \)
Skew lines\( d = \frac{|\overrightarrow{M_1M_2}\cdot(\vec p_1\times\vec p_2)|}{|\vec p_1\times\vec p_2|} \)

8. Practice problems

Try each one before opening the solution. More solved problems from this topic are in Geometry.

Problem 1: Write the line \( \frac{x - 2}{3} = \frac{y + 1}{0} = \frac{z}{4} \) in parametric form.

\( x = 2 + 3t \), \( y = -1 \), \( z = 4t \). The line lies in the plane \(y = -1\).

Problem 2: Find the line through \(P(1, 2, 3)\) perpendicular to the plane \( 2x - y + z = 7 \).

Direction = normal \(\{2, -1, 1\}\): \( \frac{x - 1}{2} = \frac{y - 2}{-1} = \frac{z - 3}{1} \).

Problem 3: Find a direction vector of the line \( x - y = 0,\ y + z = 1 \).

\( \{1, -1, 0\}\times\{0, 1, 1\} = \{-1, -1, 1\} \). A point: \(y = 0\) gives \(x = 0\), \(z = 1\). Line: \( \frac{x}{-1} = \frac{y}{-1} = \frac{z - 1}{1} \).

Problem 4: Do the lines \( \frac{x}{1} = \frac{y}{2} = \frac{z}{3} \) and \( \frac{x - 1}{1} = \frac{y - 2}{1} = \frac{z - 3}{1} \) intersect?

Both pass through \((1, 2, 3)\) (the first at \(t = 1\), the second at \(t = 0\)), and the directions are not parallel: yes, at \((1, 2, 3)\). (The mixed product of \(\{1, 2, 3\}\), \(\{1, 2, 3\}\), \(\{1, 1, 1\}\) is \(0\), as it must be.)

Problem 5: Is the line \( x = 1 + t,\ y = 2t,\ z = 3 - t \) parallel to the plane \( x + y + 3z = 0 \)?

\( 1\cdot1 + 1\cdot2 + 3\cdot(-1) = 0 \): yes, parallel. The point \((1, 0, 3)\) gives \(1 + 0 + 9 \ne 0\), so the line does not lie in the plane.

Problem 6: Find the distance from the origin to the line \( x = 1 + t,\ y = 1 - t,\ z = 2 \).

\( \overrightarrow{M_1O} = \{-1, -1, -2\} \), \( \vec p = \{1, -1, 0\} \): cross product \( \{-2, -2, 2\} \), length \(2\sqrt3\); \( d = \frac{2\sqrt3}{\sqrt2} = \sqrt6 \).

Final thoughts

A line in space is a point plus a direction. Its vector, canonical and parametric equations are three ways of saying "\(\overrightarrow{M_1M}\) is parallel to \(\vec p\)": a zero cross product, proportional components, a multiple \(t\vec p\). As the intersection of two planes, it gets its direction from the cross product of the normals. And the standard problems reduce to vector algebra: angles to dot products, distances to cross and mixed products, intersections to one equation in \(t\).

Related posts: the plane in space, and vectors (dot, cross and mixed products).