Equation of a Line
in Space
Learn to write equations of lines in 3D — both in vector form and Cartesian form, through one point or two points.
Overview
A line in 3D space is uniquely determined by either:
- A point on the line and a direction vector (or DRs)
- Two points through which the line passes
For each case, we can write the equation in two equivalent forms: Vector Form and Cartesian Form.
Vector Form — Through a Point with Given Direction
Let the line pass through a point $A$ with position vector $\vec{a}$, and be parallel to a vector $\vec{b}$. If $\vec{r}$ is the position vector of any point $P$ on the line, then $\overrightarrow{AP} = \lambda\vec{b}$ for some scalar $\lambda$.
where $\vec{a}$ = position vector of a point on the line, $\vec{b}$ = direction vector
In component form: if $\vec{a} = x_1\hat{i}+y_1\hat{j}+z_1\hat{k}$ and $\vec{b} = a\hat{i}+b\hat{j}+c\hat{k}$, then:
$$\vec{r} = (x_1\hat{i}+y_1\hat{j}+z_1\hat{k}) + \lambda(a\hat{i}+b\hat{j}+c\hat{k})$$Cartesian Form — Through a Point with Given DRs
Let the line pass through $A(x_1, y_1, z_1)$ with direction ratios $(a, b, c)$. Any point $P(x,y,z)$ on the line satisfies:
$(x_1,y_1,z_1)$ is a point on the line; $(a,b,c)$ are direction ratios
When a line is parallel to a coordinate axis:
| Line parallel to | Equation | Meaning |
|---|---|---|
| $x$-axis | $\dfrac{x-x_1}{1}=\dfrac{y-y_1}{0}=\dfrac{z-z_1}{0}$ | $y=y_1,\ z=z_1$ |
| $y$-axis | $\dfrac{x-x_1}{0}=\dfrac{y-y_1}{1}=\dfrac{z-z_1}{0}$ | $x=x_1,\ z=z_1$ |
| $z$-axis | $\dfrac{x-x_1}{0}=\dfrac{y-y_1}{0}=\dfrac{z-z_1}{1}$ | $x=x_1,\ y=y_1$ |
Vector Form — Through Two Points
If the line passes through $A$ (position vector $\vec{a}$) and $B$ (position vector $\vec{b}$), the direction is $\vec{b} - \vec{a}$:
When $\lambda=0$, $\vec{r}=\vec{a}$ (point $A$). When $\lambda=1$, $\vec{r}=\vec{b}$ (point $B$).
Cartesian Form — Through Two Points
The line through $P(x_1,y_1,z_1)$ and $Q(x_2,y_2,z_2)$ has DRs $(x_2-x_1, y_2-y_1, z_2-z_1)$:
Parametric Form
From the Cartesian equation $\dfrac{x-x_1}{a}=\dfrac{y-y_1}{b}=\dfrac{z-z_1}{c}=\lambda$, we extract coordinates:
This is extremely useful for: finding a point on the line, checking if a point lies on the line, and finding the foot of perpendicular.
Complete Comparison
Through a point + direction:
$$\vec{r} = \vec{a} + \lambda\vec{b}$$Through two points:
$$\vec{r} = \vec{a} + \lambda(\vec{b}-\vec{a})$$Through a point + DRs:
$$\frac{x-x_1}{a}=\frac{y-y_1}{b}=\frac{z-z_1}{c}$$Through two points:
$$\frac{x-x_1}{x_2-x_1}=\frac{y-y_1}{y_2-y_1}=\frac{z-z_1}{z_2-z_1}$$Solved Examples
Find the vector and Cartesian equations of the line through $A(1, 2, -3)$ with direction ratios $3, -2, 5$.
$\vec{a} = \hat{i}+2\hat{j}-3\hat{k}$, $\vec{b} = 3\hat{i}-2\hat{j}+5\hat{k}$
Vector form:
$$\vec{r} = (\hat{i}+2\hat{j}-3\hat{k}) + \lambda(3\hat{i}-2\hat{j}+5\hat{k})$$Cartesian form:
$$\frac{x-1}{3} = \frac{y-2}{-2} = \frac{z+3}{5}$$Find the vector and Cartesian equations of the line through $A(2,-1,4)$ and $B(3,2,-1)$.
$\vec{a}=2\hat{i}-\hat{j}+4\hat{k}$, $\vec{b}=3\hat{i}+2\hat{j}-\hat{k}$
Direction: $\vec{b}-\vec{a} = \hat{i}+3\hat{j}-5\hat{k}$, so DRs $= (1, 3, -5)$
Vector form:
$$\vec{r} = (2\hat{i}-\hat{j}+4\hat{k}) + \lambda(\hat{i}+3\hat{j}-5\hat{k})$$Cartesian form:
$$\frac{x-2}{1} = \frac{y+1}{3} = \frac{z-4}{-5}$$Convert the line $\dfrac{x+3}{2} = \dfrac{y-4}{1} = \dfrac{z+5}{3}$ to vector form.
Point on line: $(-3, 4, -5)$; Direction: $(2, 1, 3)$
$$\vec{r} = (-3\hat{i}+4\hat{j}-5\hat{k}) + \lambda(2\hat{i}+\hat{j}+3\hat{k})$$Find the foot of perpendicular from $P(1, 6, 3)$ to the line $\dfrac{x}{1}=\dfrac{y-1}{2}=\dfrac{z-2}{3}$.
General point on line: $Q = (\lambda,\ 1+2\lambda,\ 2+3\lambda)$
$\overrightarrow{PQ} = (\lambda-1,\ 2\lambda-5,\ 3\lambda-1)$
Direction vector $\vec{b}=(1,2,3)$. For foot of perpendicular, $\overrightarrow{PQ}\cdot\vec{b}=0$:
$$1(\lambda-1)+2(2\lambda-5)+3(3\lambda-1) = 0$$ $$\lambda - 1 + 4\lambda - 10 + 9\lambda - 3 = 0 \implies 14\lambda = 14 \implies \lambda = 1$$Foot of perpendicular: $Q = (1,\ 3,\ 5)$
Does the point $(2, 1, -1)$ lie on the line $\dfrac{x-1}{1}=\dfrac{y+1}{2}=\dfrac{z}{-1}$?
Substitute $(x,y,z)=(2,1,-1)$:
$$\frac{2-1}{1}=1,\quad \frac{1+1}{2}=1,\quad \frac{-1}{-1}=1$$All ratios equal $1$ ✓. The point $(2,1,-1)$ lies on the line (at $\lambda=1$).
- For vector form, always clearly write $\vec{r} = \ldots + \lambda(\ldots)$ with position vectors identified
- When a denominator is $0$, don't write $\frac{y-y_1}{0}$; write $y=y_1$ separately (common mistake!)
- Convert between forms: extract point and direction, then rewrite
- Two-point form frequently appears in 5-mark questions
- Foot of perpendicular: parametrize the line, use $\overrightarrow{PQ}\cdot\vec{b}=0$
- Image of a point in a line: find foot, then $\text{Image} = 2\times\text{Foot} - \text{Point}$
- Check whether two lines are parallel, intersecting, or skew (next topic: 3D3)
- Using DCs instead of DRs in the denominator — any proportional values work
- Writing $\vec{r} = \vec{a} + \lambda\vec{b}$ but using $\vec{b}$ as a point, not direction
- In two-point form, using $P-Q$ instead of $Q-P$ — doesn't matter for line, but stay consistent