Calculus 3Vectors and Space

Distances to Lines and Planes

Project onto a normal to find the shortest distance.

Not started Jump to practice

How far is a point from a plane? "Distance" always means the shortest distance, and the shortest path to a plane runs straight along its normal. So the question becomes a projection problem: how long is the part of a connecting vector that points along $\mathbf{n}$? The same idea, with a cross product, handles distances to lines.

Key idea

Point $(x_0, y_0, z_0)$ to the plane $ax + by + cz = d$: $$D = \frac{|ax_0 + by_0 + cz_0 - d|}{\sqrt{a^2 + b^2 + c^2}}.$$ Point $X$ to the line through $P_0$ with direction $\mathbf{v}$: $D = \dfrac{|\overrightarrow{P_0X} \times \mathbf{v}|}{|\mathbf{v}|}$.

Why it works

Choose any point $Q$ on the plane and let $\mathbf{w} = \overrightarrow{QX}$. The distance is the length of the shadow of $\mathbf{w}$ on the normal line: $D = \frac{|\mathbf{w} \cdot \mathbf{n}|}{|\mathbf{n}|}$. Now $$\mathbf{w} \cdot \mathbf{n} = (ax_0 + by_0 + cz_0) - (a q_1 + b q_2 + c q_3) = ax_0 + by_0 + cz_0 - d,$$ because $Q$ is on the plane. Any choice of $Q$ gives the same answer, which is why the formula needs only $d$.
For a line, the parallelogram on $\overrightarrow{P_0X}$ and $\mathbf{v}$ has area $|\overrightarrow{P_0X} \times \mathbf{v}|$ and base $|\mathbf{v}|$; its height is the distance from $X$ to the line.
The red dashed segment drops from $P$ to the plane along the normal. Move $P$ with the sliders: points on the same side give $ax + by + cz - d$ of the same sign, and the distance is its size divided by $|\mathbf{n}|$.

Worked examples

Worked example: Point to plane

Find the distance from $(1, 2, 3)$ to the plane ${}2x - y + 2z = 1$.
  1. Numerator: $|2(1) - 2 + 2(3) - 1| = |5| = 5$.
  2. Denominator: $\sqrt{4 + 1 + 4} = 3$.
  3. $D = \frac{5}{3}$.

Answer: $\frac{5}{3}$

Worked example: Parallel planes

Find the distance between $x + 2y - 2z = 3$ and ${}2x + 4y - 4z = 18$.
  1. Divide the second by 2 so the normals match: $x + 2y - 2z = 9$.
  2. The planes $\mathbf{n} \cdot X = 3$ and $\mathbf{n} \cdot X = 9$ are $\frac{|9 - 3|}{|\mathbf{n}|}$ apart.
  3. $|\mathbf{n}| = \sqrt{1 + 4 + 4} = 3$, so $D = 2$.

Answer: ${}2$

Worked example: Point to line

Find the distance from $X(1, 1, 1)$ to the line $\mathbf{r}(t) = t\langle 1, 2, 2 \rangle$.
  1. $P_0 = (0, 0, 0)$ is on the line, so $\overrightarrow{P_0X} = \langle 1, 1, 1 \rangle$.
  2. $\langle 1, 1, 1 \rangle \times \langle 1, 2, 2 \rangle = \langle 0, -1, 1 \rangle$, length $\sqrt{2}$.
  3. $|\mathbf{v}| = 3$, so $D = \frac{\sqrt{2}}{3}$.

Answer: $\frac{\sqrt{2}}{3}$

For two skew lines, the shortest connection is perpendicular to both, so it runs along $\mathbf{n} = \mathbf{v}_1 \times \mathbf{v}_2$. Project the vector between any two base points onto $\mathbf{n}$: $D = \frac{|\overrightarrow{P_1P_2} \cdot \mathbf{n}|}{|\mathbf{n}|}$.

Common mistake

Sign and form of the constant. The formula above is for planes written $ax + by + cz = d$, so you subtract $d$. If a plane is written $ax + by + cz + D = 0$, you add $D$ instead. Mixing the two forms changes the answer. Forgetting to divide by $|\mathbf{n}|$. The plane ${}2x + 4y + 4z = 4$ is the same plane as $x + 2y + 2z = 2$; your answer must not change when the equation is doubled, and only dividing by $|\mathbf{n}|$ makes that true.

Practice

Pass with 3 right answers, the last 2 in a row. Each right answer earns 3 XP.

Loading practice…

Builds on

Leads to

This is one of the top rungs of Calculus 3: Multivariable Calculus.

Sources and further reading

  • OpenStax Calculus Volume 3, 2.5 Equations of Lines and Planes in Space
@teddyrookbook GitHub