Lesson 05

Distances

This lesson answers one simple question in four different settings: how far apart are two objects in three-space? Every formula here reuses ideas from earlier lessons — normal vectors, direction vectors and projections — so the real work is knowing which formula to reach for.

By the end of this lesson

  • Find the distance from a point to a plane.
  • Find the distance from a point to a line in R³.
  • Find the distance between two parallel planes.
  • Find the distance between two parallel lines.

Section 1

Distance from a point to a plane

Given a plane \(\pi\) with equation \(Ax + By + Cz + D = 0\) and a point \(S\) not on the plane, the shortest path from \(S\) to the plane runs along the normal direction — any other path is longer. That turns the problem into a projection: project the vector from a point on the plane to \(S\) onto the unit normal vector.

The result is a single formula that takes the plane’s coefficients and the point’s coordinates directly, with no need to find a point on the plane first.

\[d = \frac{\abs{Ax_0 + By_0 + Cz_0 + D}}{\sqrt{A^2 + B^2 + C^2}}\]
(5.1)

The absolute value in the numerator matters: a distance is never negative, regardless of which side of the plane \(S\) sits on. If your answer comes out negative, you dropped the bars.

The distance from a point to a plane Coordinate axes with a shaded plane and a point S above it. A segment labelled d drops from S perpendicular to the plane, meeting it at an open circle marked with a right angle; the plane's normal vector is drawn alongside, parallel to that segment. A dashed drop line runs from S to its shadow on the xy-plane. x y z π S d n
fig. 5.1The point \(S\) sitting off the plane \(\pi\), with the normal vector \(\vv{n}\) and the shortest distance \(d\) drawn as a perpendicular segment from \(S\) to \(\pi\).
Distance lab Interactive

Move the point, choose the target, and the substitution is worked line by line. You get the answer in exact form as well as a decimal, and the foot of the perpendicular is drawn.

Section 2

Distance from a point to a line

For a line \(L\) through a point \(Q\) with direction vector \(\vv{m}\), and an external point \(S\), the shortest distance from \(S\) to \(L\) is the height of the triangle formed by \(S\), \(Q\) and the foot of the perpendicular from \(S\) onto \(L\).

\[d = \frac{\abs{\overrightarrow{QS} \times \vv{m}}}{\abs{\vv{m}}}\]
(5.2)

That height is found with the cross product: form the vector \(\overrightarrow{QS}\) from \(Q\) to \(S\), cross it with the direction vector \(\vv{m}\), and divide the magnitude of that cross product by the magnitude of \(\vv{m}\). Geometrically \(\abs{\overrightarrow{QS}\times\vv{m}}\) is the area of the parallelogram built on \(\overrightarrow{QS}\) and \(\vv{m}\), and dividing by the base \(\abs{\vv{m}}\) leaves the height — exactly the distance we want. Which point \(Q\) you pick makes no difference: sliding it along the line shears the parallelogram without changing its area.

The distance from a point to a line in three-space A line L through the point Q with direction vector m. The vector QS runs from Q to an external point S, and the two vectors span a shaded parallelogram. The perpendicular from S to the line, marked d and with a right-angle symbol at its foot, is the altitude of that parallelogram. Q S m QS d L
fig. 5.2The point \(S\), the line \(L\) with direction \(\vv{m}\) through a point \(Q\) on it, the connecting vector \(\overrightarrow{QS}\), and the perpendicular distance \(d\) from \(S\) to \(L\) — the altitude of the shaded parallelogram.

Section 3

Distance between two parallel planes

Two planes are parallel when their normal vectors are scalar multiples of one another. Because they never meet, every point on one plane is the same distance from the other — so the distance between the planes is found by picking any single point on one of them and applying the point-to-plane formula (5.1) against the other plane’s equation.

No new formula is needed here. This section is really a shortcut built entirely out of Section 1’s result, and the fact that the answer does not depend on which point you chose is what makes “the distance between two planes” a well-defined quantity at all.

The distance between two parallel planes Two shaded sheets one above the other, sharing a normal direction. A segment labelled d runs perpendicular from the lower plane to the upper one, marked with a right angle, and a second dashed segment of the same length is drawn elsewhere to show that the gap does not depend on where it is measured. π2 π1 d d
fig. 5.3Two parallel planes \(\pi_1\) and \(\pi_2\) with the constant perpendicular distance \(d\) drawn between them. Measure it anywhere you like; the answer is the same.

Section 4

Distance between two parallel lines

Two lines are parallel when their direction vectors are scalar multiples of one another. As with parallel planes, every point on one line is equally far from the other, so the distance between them is found by picking any point on one line and applying the point-to-line formula (5.2) against the other line.

Before applying the formula, always confirm that the lines really are parallel and not skew. Skew lines have no single well-defined “distance between the lines” in the same simple sense, and they need a different approach.

All four situations in this lesson come down to the two formulas in Sections 1 and 2. Identify the pair of objects, reduce it to a point-and-object problem, then substitute.

The four distance formulas

Point to a plane
\(d = \dfrac{\abs{Ax_0 + By_0 + Cz_0 + D}}{\sqrt{A^2+B^2+C^2}}\)
Point to a line
\(d = \dfrac{\abs{\overrightarrow{QS} \times \vv{m}}}{\abs{\vv{m}}}\)
Two parallel planes
Pick a point on one plane, then use the point-to-plane formula.
Two parallel lines
Pick a point on one line, then use the point-to-line formula.

Practice

Worked examples

Example 1 · routine

Find the distance from \(S(4,1,1)\) to the line \(\vv{r} = (1,1,1) + t(1,2,2)\).

  1. Read a point off the equation, \(Q(1,1,1)\), so \(\overrightarrow{QS} = S - Q = (3,0,0)\).
  2. \(\overrightarrow{QS} \times \vv{m} = \bigl((0)(2)-(0)(2),\ (0)(1)-(3)(2),\ (3)(2)-(0)(1)\bigr) = (0,\,-6,\,6)\)
  3. \(\abs{\overrightarrow{QS}\times\vv{m}} = \sqrt{0+36+36} = \sqrt{72} = 6\sqrt2, \qquad \abs{\vv{m}} = \sqrt{1+4+4} = 3\)
  4. \(d = \dfrac{6\sqrt2}{3} = 2\sqrt2\)
\(d = 2\sqrt2 \approx 2.83\) units. Sanity check: the perpendicular is the shortest path, so the answer cannot exceed \(\abs{\overrightarrow{QS}} = 3\) — and \(2.83 < 3\ \checkmark\)
Example 2 · demanding

Find the distance between the parallel planes \(2x - y + 2z = 4\) and \(4x - 2y + 4z = 10\).

  1. Check parallel and distinct. \(\vv{n}_2 = (4,-2,4) = 2(2,-1,2) = 2\vv{n}_1\), so the planes are parallel. Dividing the second equation by \(2\) gives \(2x - y + 2z = 5\), and \(5 \neq 4\), so they are distinct.
  2. Rescale first, then pick a point. \(P(2,0,0)\) lies on the first plane, since \(2(2) - 0 + 0 = 4\ \checkmark\).
  3. Apply (5.1) to the rescaled second plane, \(2x - y + 2z - 5 = 0\), whose normal has magnitude \(\abs{\vv{n}} = \sqrt{4+1+4} = 3\): \(d = \dfrac{\abs{4 - 0 + 0 - 5}}{3} = \dfrac{1}{3}\).
  4. Independence check. \((0,-4,0)\) is also on the first plane, and gives \(\dfrac{\abs{0+4+0-5}}{3} = \dfrac13\ \checkmark\)
\(d = \tfrac13\) units. Subtracting the constants before rescaling would have given \(\tfrac{10-4}{3} = 2\) — six times too big.

Watch out

Common mistakes

  • Reading \(D\) off the wrong side of the equation, or dropping the absolute value. Formula (5.1) is written for \(Ax + By + Cz + D = 0\), so the plane \(2x + y - 2z = 7\) has \(D = -7\), not \(+7\). And a negative distance always means the bars went missing; write them in from the first line.
  • Subtracting the constants of two parallel planes before making the coefficients identical. Rescale one equation first, as in Example 2, or fall back on the method that cannot go wrong: take a point on one plane and use the point-to-plane formula.
  • Rounding, and calling the decimal the answer. \(\tfrac{\sqrt6}{2}\) is the answer; \(1.2247448\ldots\) is only an approximation to it. Give the exact form first, then the decimal as a check.