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.
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.
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 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
A point to a plane
Find the distance from \((1,1,1)\) to \(x-y+2z-5=0\).
Show solution
- \(d = \dfrac{\abs{1 - 1 + 2(1) - 5}}{\sqrt{1^2 + (-1)^2 + 2^2}} = \dfrac{\abs{-3}}{\sqrt{6}}\)
- Rationalise: \(\dfrac{3}{\sqrt6} = \dfrac{3\sqrt6}{6} = \dfrac{\sqrt6}{2}\).
- \(d = \dfrac{\sqrt6}{2} \approx 1.22\) units. Leave the exact form as the answer and give the decimal as a check.
A point to a line in R²
Find the distance from \(P(7,-2)\) to \(3x-4y+1=0\).
Show solution
- \(\abs{3(7) - 4(-2) + 1} = \abs{21 + 8 + 1} = 30\). The double negative is where marks go missing.
- \(\sqrt{3^2 + (-4)^2} = \sqrt{25} = 5\).
- \(d = \dfrac{30}{5} = 6\) units.
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
- Take \(Q(1,1,1)\) from the equation, so \(\overrightarrow{QS} = (3,0,0)\).
- \(\overrightarrow{QS}\times\vv{m} = \bigl((0)(2)-(0)(2),\ (0)(1)-(3)(2),\ (3)(2)-(0)(1)\bigr) = (0,\,-6,\,6)\)
- \(\abs{\overrightarrow{QS}\times\vv{m}} = \sqrt{0+36+36} = \sqrt{72} = 6\sqrt2,\qquad \abs{\vv{m}} = \sqrt{1+4+4} = 3\)
- \(d = \dfrac{6\sqrt2}{3} = 2\sqrt2 \approx 2.83\) units.
- 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\)
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
- 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.
- \(\abs{\vv{n}} = \sqrt{4+1+4} = 3\).
- By formula: \(d = \dfrac{\abs{10-4}}{3} = \dfrac{6}{3} = 2\).
- 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\).
- 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\).
- The panels are 2 metres apart. Answer in the units the question used.
Watch out
- 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.