Lesson 05

Distances from Points to Lines and Planes

There are only three formulas in this lesson, and they are all the same idea: take any vector from the object to the point, and keep only the part of it that runs perpendicular to the object. Learn the idea and the formulas stop needing to be memorised separately.

By the end of this lesson

  • Compute the distance from a point to a plane, and justify the formula as a projection.
  • Compute the distance from a point to a line in R² and in R³.
  • Compute the distance between two parallel planes, and avoid the coefficient trap.
  • Recognise when a harder-looking problem reduces to one of these three.

Distance always means perpendicular

The distance from a point to a set of points means the shortest distance, and the shortest path from a point to a plane or a line always meets it at a right angle. Any other path is the hypotenuse of a right triangle whose leg is the perpendicular, and a hypotenuse is longer than a leg. That is the entire justification, and it is worth stating in a Communication answer.

Everything else is bookkeeping: given a vector from the object to the point, how do we extract just the perpendicular part? For a plane the perpendicular direction is handed to us — it is the normal — so we project onto it. For a line in R³ there is no single perpendicular direction, so we use a cross product instead, which measures exactly the part of a vector that is not along the line.

Point → line, R²
\(d = \dfrac{\abs{Ax_0 + By_0 + C}}{\sqrt{A^2 + B^2}}\)
Point → line, R³
\(d = \dfrac{\abs{\overrightarrow{QS} \times \vv{m}}}{\abs{\vv{m}}},\quad Q \text{ any point of the line}\)
Point → plane
\(d = \dfrac{\abs{Ax_0 + By_0 + Cz_0 + D}}{\sqrt{A^2+B^2+C^2}}\)
Parallel planes
\(d = \dfrac{\abs{D_2 - D_1}}{\sqrt{A^2+B^2+C^2}}\)
Skew lines
\(d = \dfrac{\abs{\overrightarrow{P_1P_2} \cdot (\vv{m}_1\times\vv{m}_2)}}{\abs{\vv{m}_1\times\vv{m}_2}}\)

Point to plane, and why the formula works

Take any point \(P\) on the plane and the point \(S\) whose distance you want. The shortest path from \(S\) to the plane runs along the normal, so the distance is the length of the projection of \(\overrightarrow{PS}\) onto \(\vv{n}\):

\[d = \frac{\abs{\overrightarrow{PS} \cdot \vv{n}}}{\abs{\vv{n}}}\]

Now expand with \(\vv{n} = (A,B,C)\), \(S=(x_0,y_0,z_0)\) and \(P=(x_1,y_1,z_1)\) on the plane. The numerator is \(\abs{A(x_0-x_1) + B(y_0-y_1) + C(z_0-z_1)}\), and because \(P\) is on the plane, \(Ax_1+By_1+Cz_1 = -D\). Substituting that turns the numerator into \(\abs{Ax_0+By_0+Cz_0+D}\) — the familiar formula, with the arbitrary point \(P\) gone from the answer.

That disappearance is the interesting part. It says the distance does not depend on which point of the plane you started from, which is exactly what has to be true for “the distance to the plane” to mean anything at all. The same argument reappears below for parallel planes.

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 shortest path from \(S\) to the plane is parallel to the normal. Its length is the projection of any connecting vector onto \(\vv{n}\).

Point to line

In R² a line has a normal, so nothing new is needed: the R² formula is the point-to-plane formula one dimension down, and the derivation above transfers word for word. The only thing to remember is to put the line into Cartesian form first if you were given it as a vector equation.

In R³ a line has no single normal — infinitely many directions are perpendicular to it — so projection onto a normal is not available. Instead, use the cross product. Pick any point \(Q\) on the line and form \(\overrightarrow{QS}\). Then

\[\abs{\overrightarrow{QS} \times \vv{m}} = \abs{\overrightarrow{QS}}\,\abs{\vv{m}}\sin\theta\]

where \(\theta\) is the angle between them. Dividing by \(\abs{\vv{m}}\) leaves \(\abs{\overrightarrow{QS}}\sin\theta\), which is precisely the perpendicular leg — the part of \(\overrightarrow{QS}\) that is not along the line.

Geometrically, \(\abs{\overrightarrow{QS}\times\vv{m}}\) is the area of the parallelogram built on the two vectors, and \(\abs{\vv{m}}\) is its base. Area divided by base is height. Which point \(Q\) you choose does not matter: sliding \(Q\) 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.2Area over base equals height. The parallelogram on \(\overrightarrow{QS}\) and \(\vv{m}\) has area \(\abs{\overrightarrow{QS}\times\vv{m}}\) and base \(\abs{\vv{m}}\).
Distance lab Interactive

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


Section 5

The distance between two parallel planes

Two parallel planes never meet, so the system of their equations is inconsistent — but the gap between them is a perfectly good number, and it is the same wherever you measure it. Write both with an identical coefficient triple \(\vv{n}=(A,B,C)\):

\[\pi_1: Ax+By+Cz+D_1 = 0, \qquad \pi_2: Ax+By+Cz+D_2 = 0\]

Choose any point \(P_0(x_0,y_0,z_0)\) on \(\pi_1\), so that \(Ax_0+By_0+Cz_0 = -D_1\). The distance between the planes is simply the distance from \(P_0\) to \(\pi_2\):

\[d = \frac{\abs{Ax_0+By_0+Cz_0+D_2}}{\sqrt{A^2+B^2+C^2}} = \frac{\abs{-D_1+D_2}}{\sqrt{A^2+B^2+C^2}} = \boxed{\;\frac{\abs{D_2-D_1}}{\sqrt{A^2+B^2+C^2}}\;}\]

The coordinates of \(P_0\) have vanished, so the answer does not depend on where you measured — which is exactly what makes “the distance between two planes” a well-defined quantity in the first place. In the form \(Ax+By+Cz=k\) the same result reads \(d = \abs{k_1-k_2}/\abs{\vv{n}}\).

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.3Measure anywhere you like; the answer is the same. That independence is the derivation.
The trap this formula sets
  • The formula subtracts constants, so the coefficient triples must be made identical first. The planes \(2x-y+2z=4\) and \(4x-2y+4z=10\) are parallel, but subtracting \(10-4=6\) and dividing by \(3\) gives \(2\), which is wrong. Divide the second equation by 2 first, to get \(2x-y+2z=5\); then \(d = \tfrac{\abs{5-4}}{3} = \tfrac{1}{3}\).
  • If you are unsure, fall back on the method that cannot go wrong: take a point on one plane and use the point-to-plane formula. It is one extra line of work and it never needs rescaling.

Extension: lines parallel to planes, and skew lines

The same formulas extend naturally. If a line is parallel to a plane — the inconsistent case from Lesson 04 — every point of the line is the same distance from the plane, so take any point of the line and use the point-to-plane formula.

Two skew lines also have a well-defined distance: the length of their common perpendicular. The direction of that common perpendicular must be perpendicular to both lines, so it is \(\vv{m}_1\times\vv{m}_2\), and the distance is the projection of any connecting vector onto it:

\[d = \frac{\abs{\overrightarrow{P_1P_2} \cdot (\vv{m}_1 \times \vv{m}_2)}}{\abs{\vv{m}_1\times\vv{m}_2}}\]

Notice that this is the coplanarity test from Lesson 04 divided by a length. If the triple product in the numerator is zero the lines are coplanar and the distance is zero — they meet. The skew pair from Lesson 04 had triple product \(20\) and \(\abs{\vv{m}_1\times\vv{m}_2} = \sqrt{75}\), so those two lines pass \(\tfrac{20}{\sqrt{75}} = \tfrac{4\sqrt3}{3} \approx 2.31\) units apart.

Skew-line distance belongs to Topic I rather than Topic H, so it is offered here as an extension — but it follows so directly from the work above that it would be a shame to stop one line short of it.


Practice

Worked examples

Example 1 · routine

A point to a plane

Find the distance from \((1,1,1)\) to \(x-y+2z-5=0\).

Show solution
  1. \(d = \dfrac{\abs{1 - 1 + 2(1) - 5}}{\sqrt{1^2 + (-1)^2 + 2^2}} = \dfrac{\abs{-3}}{\sqrt{6}}\)
  2. Rationalise: \(\dfrac{3}{\sqrt6} = \dfrac{3\sqrt6}{6} = \dfrac{\sqrt6}{2}\).
  3. \(d = \dfrac{\sqrt6}{2} \approx 1.22\) units. Leave the exact form as the answer and give the decimal as a check.
Example 2 · routine

A point to a line in R²

Find the distance from \(P(7,-2)\) to \(3x-4y+1=0\).

Show solution
  1. \(\abs{3(7) - 4(-2) + 1} = \abs{21 + 8 + 1} = 30\). The double negative is where marks go missing.
  2. \(\sqrt{3^2 + (-4)^2} = \sqrt{25} = 5\).
  3. \(d = \dfrac{30}{5} = 6\) units.
Example 3 · standard

A point to a line in R³

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

Show solution
  1. Take \(Q(1,1,1)\) from the equation, so \(\overrightarrow{QS} = (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 \approx 2.83\) units.
  5. Sanity check: the distance must be no more than \(\abs{\overrightarrow{QS}} = 3\), since the perpendicular is the shortest path. And \(2.83 < 3\ \checkmark\)
Example 4 · demanding

Two glass panels — the distance between parallel planes

Two glass panels in a building model lie in the parallel planes \(2x-y+2z=4\) and \(2x-y+2z=10\), with units in metres. How far apart are they?

Show solution
  1. Check they are parallel and distinct. \(\vv{n}_1 = \vv{n}_2 = (2,-1,2)\) — already identical, so no rescaling is needed — and \(4 \neq 10\), so the planes are distinct.
  2. \(\abs{\vv{n}} = \sqrt{4+1+4} = 3\).
  3. By formula: \(d = \dfrac{\abs{10-4}}{3} = \dfrac{6}{3} = 2\).
  4. By the point method, as a check. \(P(2,0,0)\) lies on the first plane, since \(2(2)-0+0 = 4\ \checkmark\). Writing the second as \(2x-y+2z-10=0\), \(d = \dfrac{\abs{4 - 0 + 0 - 10}}{3} = \dfrac{6}{3} = 2\).
  5. Independence check. \((0,-4,0)\) is also on the first plane, and gives \(\tfrac{\abs{0+4+0-10}}{3} = 2\ \checkmark\); so is \((0,0,2)\), giving \(\tfrac{\abs{0-0+4-10}}{3} = 2\ \checkmark\).
  6. The panels are 2 metres apart. Answer in the units the question used.

Watch out

Four ways to lose a mark here
  • The numerator carries an absolute value. A negative distance is not a distance; it is a dropped pair of bars. Write them in from the first line.
  • Rescale before subtracting constants. For parallel planes the coefficient triples must match exactly, or the answer is out by whatever factor you ignored.
  • Move \(D\) to the correct side. The formula is written for \(Ax+By+Cz+D=0\), so the plane \(2x+y-2z=7\) has \(D=-7\), not \(+7\).
  • Leave the answer exact. \(\tfrac{\sqrt6}{2}\) is an answer; \(1.2247448\ldots\) is a decimal approximation to one. Give the exact form first, then the decimal.