CP 6.5 - Perpendicular distances to lines and planes

CP 6.5 - Perpendicular distances to lines and planes

The shortest join to a line or plane is perpendicular, but the points where it lands are often unknown. You will locate those feet using scalar products, calculate point-to-line and point-to-plane distances, and find the shortest distance between skew or parallel lines.

The perpendicular from a point to a line

Can the shortest join between two skew lines be found without a vector product? Yes: it must be perpendicular to both directions, giving two scalar-product equations.

First solve the one-line version. Let HH be the point on a line nearest to PP. Any other line point RR makes a right-angled triangle PHRPHR, so PR2=PH2+HR2≥PH2PR^2=PH^2+HR^2\ge PH^2. Finding the perpendicular foot therefore proves that the distance is minimal.

You already know

A line point has position vector h=a+tu\mathbf h=\mathbf a+t\mathbf u. The vector from PP to HH is h−p\mathbf h-\mathbf p, and perpendicularity to a non-zero direction u\mathbf u means (h−p).u=0(\mathbf h-\mathbf p).\mathbf u=0.

Substitution turns the right-angle condition into one linear equation.

Foot from a point to a line

For line r=a+tu\mathbf r=\mathbf a+t\mathbf u, u≠0\mathbf u\ne\mathbf0, and point PP with position vector p\mathbf p,

t=(p−a).uu.u,h=a+tu,d=∣p−h∣t=\frac{(\mathbf p-\mathbf a).\mathbf u}{\mathbf u.\mathbf u}, \qquad \mathbf h=\mathbf a+t\mathbf u, \qquad d=|\mathbf p-\mathbf h|

The denominator is ∣u∣2>0|\mathbf u|^2>0, so the foot is unique. If PP lies on the line, the distance is zero. Not in the formula booklet: learn it.

You may derive the parameter each time from the zero-product condition; that often makes the geometry clearer than inserting values into the fraction.

Worked example 1: finding the foot before the distance

Question. Find the perpendicular distance from P=(2,3,4)P=(2,3,4) to r=(1,0,0)T+t(1,2,2)T\mathbf r=(1,0,0)^{\mathrm T}+t(1,2,2)^{\mathrm T}.

Plan. Write the general foot, make its displacement from PP perpendicular to the line, then calculate its length.

H=(1+t,2t,2t)point on the linePH→=(t−1,2t−3,2t−4)Tsubtract P(t−1)+2(2t−3)+2(2t−4)=0perpendicular to (1,2,2)T9t−15=0⟹t=53solvePH→=(2/3,1/3,−2/3)Tsubstituted=49+19+49=1length of the join\begin{aligned} H&=(1+t,2t,2t) && \text{point on the line} \\ \overrightarrow{PH}&=(t-1,2t-3,2t-4)^{\mathrm T} && \text{subtract }P \\ (t-1)+2(2t-3)+2(2t-4)&=0 && \text{perpendicular to }(1,2,2)^{\mathrm T} \\ 9t-15&=0\quad\Longrightarrow\quad t=\frac53 && \text{solve} \\ \overrightarrow{PH}&=(2/3,1/3,-2/3)^{\mathrm T} && \text{substitute} \\ d&=\sqrt{\frac49+\frac19+\frac49}=1 && \text{length of the join} \end{aligned}

Why this step? The distance from PP to the line's anchor is just one possible join; only the perpendicular join is shortest.

Answer. The distance is 11, with foot H=(8/3,10/3,10/3)H=(8/3,10/3,10/3).

Check. (2/3,1/3,−2/3)T.(1,2,2)T=0(2/3,1/3,-2/3)^{\mathrm T}.(1,2,2)^{\mathrm T}=0.

Worked example 2 changes only the height of PP, from 44 to 77.

Worked example 2: a moved point changes the foot

Question. Find the distance from P=(2,3,7)P=(2,3,7) to the same line.

Plan. Keep the general line point and update the displacement before imposing perpendicularity.

(t−1)+2(2t−3)+2(2t−7)=0new zero-product condition9t−21=0⟹t=73solveH=(10/3,14/3,14/3)point on the linePH→=(4/3,5/3,−7/3)Tsubtract the new pointd=16+25+493=10exact length\begin{aligned} (t-1)+2(2t-3)+2(2t-7)&=0 && \text{new zero-product condition} \\ 9t-21&=0\quad\Longrightarrow\quad t=\frac73 && \text{solve} \\ H&=(10/3,14/3,14/3) && \text{point on the line} \\ \overrightarrow{PH}&=(4/3,5/3,-7/3)^{\mathrm T} && \text{subtract the new point} \\ d&=\frac{\sqrt{16+25+49}}3=\sqrt{10} && \text{exact length} \end{aligned}

Why this step? Reusing the old foot would not normally preserve the right angle after moving PP.

Answer. d=10d=\sqrt{10}.

Check. The displacement product is (4+10−14)/3=0(4+10-14)/3=0; its squared length is 1010.

There is a useful surprise in the first example: coordinates with several thirds still produce the exact whole-number distance 11. Keep fractions until the final square root.

Watch out

Wrong: minimise a coordinate difference alone, or measure only to the anchor. Right: the full three-dimensional displacement must be perpendicular to the line direction.

Change the height once more for your turn.

The perpendicular from a point to a plane

For a plane, the shortest join is parallel to its normal, and a supplied formula gives its length directly.

Let the plane be r.n=k\mathbf r.\mathbf n=k. If HH is the perpendicular foot, write p−h=sn\mathbf p-\mathbf h=s\mathbf n. Taking scalar products with n\mathbf n gives s=(p.n−k)/∣n∣2s=(\mathbf p.\mathbf n-k)/|\mathbf n|^2. The distance is ∣s∣∣n∣|s||\mathbf n|, which yields the formula below.

Distance from a point to a plane

For non-zero normal n=(a,b,c)T\mathbf n=(a,b,c)^{\mathrm T}, plane ax+by+cz+d=0ax+by+cz+d=0, and point P=(α,β,γ)P=(\alpha,\beta,\gamma),

D=∣aα+bβ+cγ+d∣a2+b2+c2D=\frac{|a\alpha+b\beta+c\gamma+d|}{\sqrt{a^2+b^2+c^2}}

Use the absolute value: distance is non-negative, whichever side of the plane contains PP. In the formula booklet.

If the foot is required too, follow the normal from PP to the plane. The foot formula h=p−((p.n−k)/∣n∣2)n\mathbf h=\mathbf p-((\mathbf p.\mathbf n-k)/|\mathbf n|^2)\mathbf n is not printed in the booklet; derive it by substitution when needed.

Worked example 3: distance and foot

Question. Find the distance from P=(2,3,4)P=(2,3,4) to x+2y+2z=9x+2y+2z=9, and the perpendicular foot.

Plan. Use the supplied distance formula, then move from PP along the normal to locate the foot.

D=∣2+2(3)+2(4)−9∣1+4+4=73distance formulaH=P−s(1,2,2)normal displacement16−9s=9⟹s=79foot lies in the planeH=(11/9,13/9,22/9)substitute the parameter\begin{aligned} D&=\frac{|2+2(3)+2(4)-9|}{\sqrt{1+4+4}}=\frac73 && \text{distance formula} \\ H&=P-s(1,2,2) && \text{normal displacement} \\ 16-9s&=9\quad\Longrightarrow\quad s=\frac79 && \text{foot lies in the plane} \\ H&=(11/9,13/9,22/9) && \text{substitute the parameter} \end{aligned}

Why this step? The normal has length 33, so its multiplier ss is not itself the distance: D=∣s∣×3D=|s|\times3.

Answer. Distance 7/37/3; foot (11/9,13/9,22/9)(11/9,13/9,22/9).

Check. (11+26+44)/9=9(11+26+44)/9=9, and the normal displacement length is (7/9)(3)=7/3(7/9)(3)=7/3.

Worked example 4 changes only the plane constant from 99 to 1818, putting the plane on the other side of PP.

Worked example 4: the absolute value matters

Question. Find the distance and foot from the same PP to x+2y+2z=18x+2y+2z=18.

Plan. Retain the normal and update the constant in both calculations.

D=∣16−18∣3=23absolute value16−9s=18⟹s=−29signed normal parameterH=P+29(1,2,2)=(20/9,31/9,40/9)negative s reverses the movement\begin{aligned} D&=\frac{|16-18|}{3}=\frac23 && \text{absolute value} \\ 16-9s&=18\quad\Longrightarrow\quad s=-\frac29 && \text{signed normal parameter} \\ H&=P+\frac29(1,2,2)=(20/9,31/9,40/9) && \text{negative }s\text{ reverses the movement} \end{aligned}

Why this step? The signed parameter tells you which way to move, but taking a distance discards that sign.

Answer. Distance 2/32/3; foot (20/9,31/9,40/9)(20/9,31/9,40/9).

Check. (20+62+80)/9=18(20+62+80)/9=18, and the displacement has length (2/9)(3)=2/3(2/9)(3)=2/3.

Multiplying a plane equation by any non-zero number scales both the numerator and denominator of the distance formula equally, so the distance stays unchanged.

Watch out

Wrong: insert +9+9 for the constant of x+2y+2z=9x+2y+2z=9. Right: first write x+2y+2z−9=0x+2y+2z-9=0, so the formula's constant is −9-9.

The next plane lies between the two just used.

A common perpendicular between skew lines

The shortest segment joining non-parallel lines is perpendicular to both directions, giving two equations for its two unknown endpoints.

Let P=a+suP=\mathbf a+s\mathbf u lie on the first line and Q=b+tvQ=\mathbf b+t\mathbf v on the second. Form w=PQ→\mathbf w=\overrightarrow{PQ}. Impose w.u=0\mathbf w.\mathbf u=0 and w.v=0\mathbf w.\mathbf v=0, solve for s,ts,t, then find ∣w∣|\mathbf w|.

[DIAGRAM: asset_name: The common perpendicular between two skew lines; asset_slug: 9fm0-cp44-common-perpendicular; caption: The shortest connector is perpendicular to both line directions; description: An exact spatial plot shows the line through the origin with direction (1,1,0), the line through (0,1,5) with direction (1,0,1), and their common perpendicular from P at (minus 1,minus 1,0) to Q at (minus 3,1,2). Labels identify the directions, endpoints and connector vector (minus 2,2,2), and a separate panel displays its zero scalar products with both directions]
The shortest connector is perpendicular to both line directions

This really is a minimum. Any other joining displacement equals w+δtv−δsu\mathbf w+\delta t\mathbf v-\delta s\mathbf u. The added vector is perpendicular to w\mathbf w, so its squared length is ∣w∣2+∣δtv−δsu∣2|\mathbf w|^2+|\delta t\mathbf v-\delta s\mathbf u|^2, never smaller than ∣w∣2|\mathbf w|^2.

Common-perpendicular equations

For non-zero, non-parallel directions u,v\mathbf u,\mathbf v, set

w=b+tv−a−su\mathbf w=\mathbf b+t\mathbf v-\mathbf a-s\mathbf u

and solve

w.u=0,w.v=0\mathbf w.\mathbf u=0,\qquad\mathbf w.\mathbf v=0

The shortest distance is ∣w∣|\mathbf w|. It is positive for skew lines and zero for intersecting lines. Not in the formula booklet: learn it.

Keep the two endpoint parameters distinct. Perpendicularity to just one line does not locate the shortest join between both.

Worked example 5: solving for both endpoints

Question. Find the shortest distance between l:r=s(1,1,0)Tl:\mathbf r=s(1,1,0)^{\mathrm T} and m:r=(0,1,2)T+t(1,0,1)Tm:\mathbf r=(0,1,2)^{\mathrm T}+t(1,0,1)^{\mathrm T}.

Plan. Write the general joining vector and make both scalar products zero.

w=(t−s,1−s,2+t)TQ−Pt−2s+1=0w.(1,1,0)T=02t−s+2=0w.(1,0,1)T=0s=0,t=−1solve simultaneouslyw=(−1,1,1)T,D=3join length\begin{aligned} \mathbf w&=(t-s,1-s,2+t)^{\mathrm T} && Q-P \\ t-2s+1&=0 && \mathbf w.(1,1,0)^{\mathrm T}=0 \\ 2t-s+2&=0 && \mathbf w.(1,0,1)^{\mathrm T}=0 \\ s&=0,\quad t=-1 && \text{solve simultaneously} \\ \mathbf w&=(-1,1,1)^{\mathrm T},\quad D=\sqrt3 && \text{join length} \end{aligned}

Why this step? Both endpoints can move, so the shortest segment must resist movement along either line direction.

Answer. D=3D=\sqrt3, between P=(0,0,0)P=(0,0,0) and Q=(−1,1,1)Q=(-1,1,1).

Check. (−1,1,1)T(-1,1,1)^{\mathrm T} has zero scalar product with both (1,1,0)T(1,1,0)^{\mathrm T} and (1,0,1)T(1,0,1)^{\mathrm T}.

Worked example 6 changes only the second line's starting height from 22 to 55.

Worked example 6: moving one skew line

Question. Keep ll, but let m:r=(0,1,5)T+t(1,0,1)Tm:\mathbf r=(0,1,5)^{\mathrm T}+t(1,0,1)^{\mathrm T}. Find the shortest distance.

Plan. Update the connector's last component and solve the two perpendicularity equations again.

w=(t−s,1−s,5+t)Tnew connectort−2s+1=0,2t−s+5=0two zero productss=−1,t=−3simultaneous solutionP=(−1,−1,0),Q=(−3,1,2)endpoints on their linesw=(−2,2,2)T,D=12=23exact distance\begin{aligned} \mathbf w&=(t-s,1-s,5+t)^{\mathrm T} && \text{new connector} \\ t-2s+1&=0,\quad2t-s+5=0 && \text{two zero products} \\ s&=-1,\quad t=-3 && \text{simultaneous solution} \\ P&=(-1,-1,0),\quad Q=(-3,1,2) && \text{endpoints on their lines} \\ \mathbf w&=(-2,2,2)^{\mathrm T},\quad D=\sqrt{12}=2\sqrt3 && \text{exact distance} \end{aligned}

Why this step? Moving a line can move both feet of the common perpendicular; it is unsafe to keep the old endpoints.

Answer. D=23D=2\sqrt3.

Check. −2+2=0-2+2=0 for each direction product, and both endpoint equations are satisfied.

The opening question is answered: scalar products provide the common perpendicular directly, with no vector product needed.

Watch out

Wrong: make the connector perpendicular to only one direction, or set s=ts=t. Right: use two independent parameters and both zero-product equations.

Move the second anchor's height again in the next problem.

The distance between parallel lines

For parallel lines, fix any point on one line and find its perpendicular distance to the other.

Every point on the first line gives the same distance: moving it along the common direction moves its perpendicular foot by the same amount. There are infinitely many shortest connecting segments, all with the same length. This differs from the unique shortest connector of non-parallel skew lines.

Parallel-line distance

For distinct parallel lines, select any point BB on one and find the point-to-line distance from BB to the other. The connector is perpendicular to their common non-zero direction. Coincident lines have distance zero. Not in the formula booklet: learn it.

The existing point-to-line method does all the work; the first step is to recognise proportional direction vectors.

Worked example 7: one point represents a parallel line

Question. Find the distance between l:r=s(1,1,0)Tl:\mathbf r=s(1,1,0)^{\mathrm T} and m:r=(3,1,2)T+t(2,2,0)Tm:\mathbf r=(3,1,2)^{\mathrm T}+t(2,2,0)^{\mathrm T}.

Plan. Check parallel directions, take B=(3,1,2)B=(3,1,2), and project it onto ll.

(2,2,0)T=2(1,1,0)Tparallel directionsH=(s,s,0),HB→=(3−s,1−s,2)Tfoot on l(3−s)+(1−s)=0⟹s=2perpendicularityD=∣(1,−1,2)T∣=6shortest join\begin{aligned} (2,2,0)^{\mathrm T}&=2(1,1,0)^{\mathrm T} && \text{parallel directions} \\ H&=(s,s,0),\quad\overrightarrow{HB}=(3-s,1-s,2)^{\mathrm T} && \text{foot on }l \\ (3-s)+(1-s)&=0\quad\Longrightarrow\quad s=2 && \text{perpendicularity} \\ D&=|(1,-1,2)^{\mathrm T}|=\sqrt6 && \text{shortest join} \end{aligned}

Why this step? Fixing one anchor is valid here precisely because the lines are parallel; the skew-line problem required both endpoints to move.

Answer. D=6D=\sqrt6.

Check. The connector has zero scalar product with (1,1,0)T(1,1,0)^{\mathrm T} and hence with (2,2,0)T(2,2,0)^{\mathrm T} too.

Worked example 8 changes only the second anchor's height from 22 to 55.

Worked example 8: a changed parallel separation

Question. Find the distance between ll and r=(3,1,5)T+t(2,2,0)T\mathbf r=(3,1,5)^{\mathrm T}+t(2,2,0)^{\mathrm T}.

Plan. Project the new anchor onto ll, using the same common direction.

(3−s)+(1−s)=0⟹s=2unchanged horizontal projectionHB→=(1,−1,5)Tnew anchor heightD=1+1+25=33exact length\begin{aligned} (3-s)+(1-s)&=0\quad\Longrightarrow\quad s=2 && \text{unchanged horizontal projection} \\ \overrightarrow{HB}&=(1,-1,5)^{\mathrm T} && \text{new anchor height} \\ D&=\sqrt{1+1+25}=3\sqrt3 && \text{exact length} \end{aligned}

Why this step? The direction has zero vertical component, so changing only the height leaves the foot on ll unchanged while changing the connector length.

Answer. D=33D=3\sqrt3.

Check. (1,−1,5)T.(1,1,0)T=0(1,-1,5)^{\mathrm T}.(1,1,0)^{\mathrm T}=0, and D2=27D^2=27.

If the second anchor were (3,3,0)(3,3,0), it would already lie on ll, giving coincident lines and distance zero. Never assume a positive gap merely because two different equations are written.

Watch out

Wrong: the distance between parallel lines is the distance between their printed anchors. Right: one anchor must be joined to its perpendicular foot on the other line.

The last calculation changes the height once more.

Quick Recap

  • Point to line: find the foot by making the joining vector perpendicular to the line direction.
  • Point to plane: use the supplied absolute-value formula, or follow the plane normal to its intersection.
  • Skew lines: two moving endpoints and two zero scalar products locate the common perpendicular.
  • Parallel lines: fix one anchor and use point-to-line distance; coincident lines have zero distance.

The shortest join between skew lines needs no vector product: perpendicularity to both directions gives the two equations that locate it.