4.04h–4.04j - Finding shortest distances

4.04h–4.04j - Finding shortest distances

Find perpendicular distances from points to lines and planes, and between parallel or skew lines. In 4.04h the objects are two lines; 4.04i covers a point and a line in two or three dimensions; 4.04j covers a point and a plane. You will choose the right normal or perpendicular rather than measuring an arbitrary joining segment.

A point and a line in two dimensions

Two cables follow the skew lines r=(1,0,0)+t(1,1,0)\mathbf{r}=(1,0,0)+t(1,1,0) and r=(0,1,5)+s(0,1,1)\mathbf{r}=(0,1,5)+s(0,1,1). How close do the complete lines come, even though they never meet? We will find their separation without guessing two nearest points. First, consider the simpler distance from a point to a line.

You already know

The shortest segment from a point to a line or plane is perpendicular to it. A scalar product of zero tests perpendicular directions. A vector product gives a common perpendicular to two non-parallel directions.

Take P(3,4)P(3,4) and the line 3x+4y=103x+4y=10. Its normal is (3,4)(3,4), of length 5. The expression 3x+4y3x+4y is constant along the line. It changes from 10 on the line to 25 at PP; moving one unit in the unit-normal direction changes it by 5. The perpendicular distance is therefore (25−10)/5=3(25-10)/5=3.

This explains both parts of the formula: the numerator measures the change in the line's constraint, and the denominator converts that change into a distance.

Distance from a point to a two-dimensional line

For P(x1,y1)P(x_1,y_1) and ax+by=cax+by=c, where (a,b)≠(0,0)(a,b)\ne(0,0),

D=∣ax1+by1−c∣a2+b2D=\frac{|ax_1+by_1-c|}{\sqrt{a^2+b^2}}

In the formula booklet.

The modulus makes the distance non-negative on either side of the line. It is zero precisely when the point lies on the line. Vertical and horizontal lines work too: for x=4x=4, the formula becomes ∣x1−4∣|x_1-4|. There is no need to invent an infinite gradient.

Worked example 1: a supplied formula

Question. Find the exact distance from P(3,4)P(3,4) to 3x+4y=103x+4y=10.

Plan. Identify a,b,ca,b,c, then substitute into the point-line formula.

a=3,b=4,c=10required equation formD=∣3(3)+4(4)−10∣32+42substitute=155=3evaluate\begin{aligned} a&=3,\quad b=4,\quad c=10 && \text{required equation form}\\ D&=\frac{|3(3)+4(4)-10|}{\sqrt{3^2+4^2}} && \text{substitute}\\ &=\frac{15}{5}=3 && \text{evaluate} \end{aligned}

Why this step? The denominator is the length of a normal, not the length of the position vector of PP.

Answer. D=3D=3.

Check. The foot is F=(6/5,8/5)F=(6/5,8/5): 3(6/5)+4(8/5)=103(6/5)+4(8/5)=10, and FP→=(9/5,12/5)\overrightarrow{FP}=(9/5,12/5) is normal with length 3.

Worked example 2 changes one feature: the constant appears on the left of the line equation. Rewriting it first prevents a sign error.

Worked example 2: the constant on the other side

Question. Find the exact distance from P(3,4)P(3,4) to 3x+4y+10=03x+4y+10=0.

Plan. Write the line as 3x+4y=−103x+4y=-10, then use the formula.

c=−10move the constantD=∣3(3)+4(4)−(−10)∣5substitute with its sign=355=7evaluate\begin{aligned} c&=-10 && \text{move the constant}\\ D&=\frac{|3(3)+4(4)-(-10)|}{5} && \text{substitute with its sign}\\ &=\frac{35}{5}=7 && \text{evaluate} \end{aligned}

Why this step? The formula subtracts the right-hand constant. Here subtracting −10-10 adds 10.

Answer. D=7D=7.

Check. F=(−6/5,−8/5)F=(-6/5,-8/5) lies on the line. The vector from FF to PP is (21/5,28/5)(21/5,28/5), parallel to (3,4)(3,4), with length 7.

Keep the entire signed numerator inside the modulus until it is evaluated.

Watch out

Wrong: D=(ax1+by1−c)/a2+b2D=(ax_1+by_1-c)/\sqrt{a^2+b^2}, allowing a negative answer. Right: put the whole numerator in a modulus. The sign identifies a side of the line; distance has no sign.

Practise moving a constant and handling a negative numerator together.

A point and a line in three dimensions

For a line in space, find the foot by requiring its joining vector from the point to be perpendicular to the line's direction.

Let PP have position vector p\mathbf{p}, and let a general point FF on the line be a+tu\mathbf{a}+t\mathbf{u}. At the nearest point, FP→=p−a−tu\overrightarrow{FP}=\mathbf{p}-\mathbf{a}-t\mathbf{u} has zero scalar product with u\mathbf{u}. Solve that scalar equation, then calculate ∣FP→∣|\overrightarrow{FP}|. This works in two dimensions too, especially when a line is already given in vector form.

[DIAGRAM: asset_name: A perpendicular gives the minimum distance; asset_slug: h245_4_04h_j_perpendicular_distance; caption: Every other joining segment has an extra component along the line; description: Exact equal-scale two-dimensional diagram of P=(3,4), the line 3x+4y=10, foot F=(1.2,1.6), and another point Q on the line. PF is the sage perpendicular of length 3, PQ is a longer clay segment, and a right-angle marker at F shows the triangle PFQ.]
Every other joining segment has an extra component along the line

Perpendicular foot on a vector line

For a non-zero line direction u\mathbf{u}, the foot F=a+tuF=\mathbf{a}+t\mathbf{u} from PP satisfies

(p−a−tu)⋅u=0⇒t=(p−a)⋅uu⋅u(\mathbf{p}-\mathbf{a}-t\mathbf{u})\cdot\mathbf{u}=0 \quad\Rightarrow\quad t=\frac{(\mathbf{p}-\mathbf{a})\cdot\mathbf{u}}{\mathbf{u}\cdot\mathbf{u}}

The distance is D=∣p−a−tu∣D=|\mathbf{p}-\mathbf{a}-t\mathbf{u}|.
Not in the formula booklet: learn it.

Why is this the minimum, rather than merely a perpendicular? For any other line point QQ, PFQPFQ is right-angled at FF, so PQ2=PF2+FQ2≥PF2PQ^2=PF^2+FQ^2\ge PF^2. Equality holds only at Q=FQ=F. If PP already lies on the line, the same method gives F=PF=P and distance zero.

Worked example 3: finding the foot

Question. Find the shortest distance from P(4,3,2)P(4,3,2) to l:r=(1,0,2)+t(2,1,2)l:\mathbf{r}=(1,0,2)+t(2,1,2).

Plan. Impose FP⊥lFP\perp l, solve for tt, then find PFPF.

F=(1+2t,t,2+2t)general line pointFP→=(3−2t,3−t,−2t)P−F2(3−2t)+(3−t)+2(−2t)=0FP→⋅(2,1,2)=09−9t=0⇒t=1solveF=(3,1,4),FP→=(1,2,−2)substituteD=1+4+4=3length\begin{aligned} F&=(1+2t,t,2+2t) && \text{general line point}\\ \overrightarrow{FP}&=(3-2t,3-t,-2t) && P-F\\ 2(3-2t)+(3-t)+2(-2t)&=0 && \overrightarrow{FP}\cdot(2,1,2)=0\\ 9-9t&=0\quad\Rightarrow\quad t=1 && \text{solve}\\ F&=(3,1,4),\quad\overrightarrow{FP}=(1,2,-2) && \text{substitute}\\ D&=\sqrt{1+4+4}=3 && \text{length} \end{aligned}

Why this step? Finding the distance from the starting point (1,0,2)(1,0,2) to PP would give an arbitrary joining length, not the minimum.

Answer. D=3D=3.

Check. (1,2,−2)⋅(2,1,2)=2+2−4=0(1,2,-2)\cdot(2,1,2)=2+2-4=0, and FF lies on the line at t=1t=1.

Worked example 4 changes one feature: PP's last coordinate becomes −7-7. The nearest foot now has a negative parameter, which is allowed on a complete line.

Worked example 4: a foot behind the starting point

Question. Find the exact shortest distance from P(4,3,−7)P(4,3,-7) to r=(1,0,2)+t(2,1,2)\mathbf{r}=(1,0,2)+t(2,1,2).

Plan. Apply the same perpendicularity condition with the new displacement.

FP→=(3−2t,3−t,−9−2t)new point minus F2(3−2t)+(3−t)+2(−9−2t)=0perpendicularity−9−9t=0⇒t=−1solveF=(−1,−1,0)line pointFP→=(5,4,−7)shortest displacementD=25+16+49=310exact length\begin{aligned} \overrightarrow{FP}&=(3-2t,3-t,-9-2t) && \text{new point minus }F\\ 2(3-2t)+(3-t)+2(-9-2t)&=0 && \text{perpendicularity}\\ -9-9t&=0\quad\Rightarrow\quad t=-1 && \text{solve}\\ F&=(-1,-1,0) && \text{line point}\\ \overrightarrow{FP}&=(5,4,-7) && \text{shortest displacement}\\ D&=\sqrt{25+16+49}=3\sqrt{10} && \text{exact length} \end{aligned}

Why this step? The parameter records position along the chosen direction; it is not itself a distance and need not be positive.

Answer. 3103\sqrt{10}.

Check. (5,4,−7)⋅(2,1,2)=10+4−14=0(5,4,-7)\cdot(2,1,2)=10+4-14=0.

The joining vector's perpendicularity is the decisive check, not the sign of the line parameter.

Watch out

Wrong: (p−a)⋅u=0(\mathbf{p}-\mathbf{a})\cdot\mathbf{u}=0 without including the unknown foot. Right: use p−(a+tu)\mathbf{p}-(\mathbf{a}+t\mathbf{u}), so the equation can locate the foot.

In a model with a finite cable, also check whether the foot lies between its endpoints. The complete-line minimum may be outside the cable; then the nearer endpoint gives the segment minimum.

Two parallel lines

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

The choice of point does not affect the distance. Translating the point and its perpendicular foot by the same multiple of the common direction preserves both membership and perpendicularity. In two dimensions, convert one line to cartesian form and use the supplied point-line formula. In three dimensions, use the scalar-product foot method from the previous part. There is no separate parallel-line distance formula in the booklet.

Worked example 5: reduce to point and line

Question. Find the distance between

l1:r=(1,1,1)+t(1,2,2),l2:r=(5,4,5)+s(2,4,4)l_1:\mathbf{r}=(1,1,1)+t(1,2,2),\qquad l_2:\mathbf{r}=(5,4,5)+s(2,4,4)

Plan. Verify parallel directions, then find the perpendicular distance from B(5,4,5)B(5,4,5) to l1l_1.

(2,4,4)=2(1,2,2)parallel directionsFB→=(4−t,3−2t,4−2t)F=(1,1,1)+t(1,2,2)(4−t)+2(3−2t)+2(4−2t)=0perpendicularity18−9t=0⇒t=2solveF=(3,5,5),FB→=(2,−1,0)shortest joinD=5length\begin{aligned} (2,4,4)&=2(1,2,2) && \text{parallel directions}\\ \overrightarrow{FB}&=(4-t,3-2t,4-2t) && F=(1,1,1)+t(1,2,2)\\ (4-t)+2(3-2t)+2(4-2t)&=0 && \text{perpendicularity}\\ 18-9t&=0\quad\Rightarrow\quad t=2 && \text{solve}\\ F&=(3,5,5),\quad\overrightarrow{FB}=(2,-1,0) && \text{shortest join}\\ D&=\sqrt5 && \text{length} \end{aligned}

Why this step? Parallel lines have a whole family of perpendicular joins. Fixing one endpoint leaves only one parameter to find.

Answer. 5\sqrt5.

Check. (2,−1,0)⋅(1,2,2)=0(2,-1,0)\cdot(1,2,2)=0, and the non-zero distance confirms that the lines are distinct.

Worked example 6 changes one feature: the chosen starting point on the second line moves along that line. The foot moves too, but the distance stays fixed.

Worked example 6: another point on the same parallel line

Question. Find the distance between

l1:r=(1,1,1)+t(1,2,2),l2:r=(6,6,7)+s(2,4,4)l_1:\mathbf{r}=(1,1,1)+t(1,2,2),\qquad l_2:\mathbf{r}=(6,6,7)+s(2,4,4)

Plan. Use B(6,6,7)B(6,6,7) for the point-to-line reduction.

FB→=(5−t,5−2t,6−2t)B−F(5−t)+2(5−2t)+2(6−2t)=0perpendicularity27−9t=0⇒t=3solveF=(4,7,7)new footFB→=(2,−1,0),D=5same perpendicular join\begin{aligned} \overrightarrow{FB}&=(5-t,5-2t,6-2t) && B-F\\ (5-t)+2(5-2t)+2(6-2t)&=0 && \text{perpendicularity}\\ 27-9t&=0\quad\Rightarrow\quad t=3 && \text{solve}\\ F&=(4,7,7) && \text{new foot}\\ \overrightarrow{FB}&=(2,-1,0),\quad D=\sqrt5 && \text{same perpendicular join} \end{aligned}

Why this step? The second starting point has moved by (1,2,2)(1,2,2), which is half its direction vector. It is another point on exactly the same second line.

Answer. 5\sqrt5.

Check. Both BB and FF have translated by (1,2,2)(1,2,2), so their difference is unchanged.

In two dimensions the same reasoning can be very short. For 3x+4y=103x+4y=10 and 3x+4y=253x+4y=25, any point of the second line makes the first numerator ∣25−10∣|25-10|, giving distance 15/5=315/5=3. If the equations have differently scaled normals, first rescale the entire equations to the same left side. Coincident lines have distance zero.

Watch out

Wrong: taking the vector product of parallel directions and dividing by its magnitude. Their product is zero, so that expression is undefined. Right: reduce parallel lines to a point-line problem.

Check the relationship before choosing a two-line distance method.

The gap between skew lines

For non-parallel lines, a common perpendicular direction allows you to measure the gap without first finding its endpoints.

Let a,b\mathbf{a},\mathbf{b} be positions of any chosen points on the two lines, with directions u,v\mathbf{u},\mathbf{v}. Take a non-zero common perpendicular n\mathbf{n}, supplied or constructed as u×v\mathbf{u}\times\mathbf{v}. The component of b−a\mathbf{b}-\mathbf{a} along the unit normal is (b−a)⋅n/∣n∣(\mathbf{b}-\mathbf{a})\cdot\mathbf{n}/|\mathbf{n}|. Its absolute value is the separation.

Why can you choose any points? Changing them adds multiples of u\mathbf{u} and v\mathbf{v} to the joining vector. Those extra terms have zero scalar product with n\mathbf{n}, so the normal component is unchanged. The two independent directions span the plane perpendicular to n\mathbf{n}, so suitable movements along the lines remove the joining vector's entire component in that plane. The remaining join is parallel to n\mathbf{n} and has the minimum length. This explains the formula without using any result about the magnitude of a vector product.

Shortest distance between skew lines

For skew lines with points a,b\mathbf{a},\mathbf{b} and a non-zero common perpendicular n\mathbf{n},

D=∣(b−a)⋅n∣∣n∣D=\frac{|(\mathbf{b}-\mathbf{a})\cdot\mathbf{n}|}{|\mathbf{n}|}

Either a suitable n\mathbf{n} is supplied or you establish one, for example using the supplied vector-product formula.
In the formula booklet.

The common perpendicular need not be a unit vector: the denominator accounts for its length. For non-parallel intersecting lines the same normal component is zero, consistently giving zero distance. For parallel directions the vector product vanishes and must not be used as a normal in this formula.

Worked example 7: construct the common perpendicular

Question. Find the shortest distance between

l1:r=(1,0,0)+t(1,1,0),l2:r=(0,1,5)+s(0,1,1)l_1:\mathbf{r}=(1,0,0)+t(1,1,0),\qquad l_2:\mathbf{r}=(0,1,5)+s(0,1,1)

Plan. Find a common perpendicular, then project the starting-point displacement onto it.

n=(1,1,0)×(0,1,1)=(1,−1,1)common perpendicularb−a=(−1,1,5)join chosen points(b−a)⋅n=−1−1+5=3normal component numeratorD=∣3∣3=3supplied distance formula\begin{aligned} \mathbf{n}&=(1,1,0)\times(0,1,1)=(1,-1,1) && \text{common perpendicular}\\ \mathbf{b}-\mathbf{a}&=(-1,1,5) && \text{join chosen points}\\ (\mathbf{b}-\mathbf{a})\cdot\mathbf{n}&=-1-1+5=3 && \text{normal component numerator}\\ D&=\frac{|3|}{\sqrt3}=\sqrt3 && \text{supplied distance formula} \end{aligned}

Why this step? The chosen joining vector is not generally perpendicular to either line. Projecting onto the common normal removes both along-line components.

Answer. 3\sqrt3.

Check. n⋅(1,1,0)=0\mathbf{n}\cdot(1,1,0)=0 and n⋅(0,1,1)=0\mathbf{n}\cdot(0,1,1)=0. Its non-zero projected gap also confirms the non-parallel lines do not intersect.

Worked example 8 changes one feature: the second starting point's height changes from 5 to −1-1. The signed normal component reverses, but the distance does not.

Worked example 8: a negative scalar product

Question. Find the shortest distance between r=(1,0,0)+t(1,1,0)\mathbf{r}=(1,0,0)+t(1,1,0) and r=(0,1,−1)+s(0,1,1)\mathbf{r}=(0,1,-1)+s(0,1,1).

Plan. Reuse the common perpendicular because the line directions have not changed.

n=(1,−1,1)same directionsb−a=(−1,1,−1)new point displacement(b−a)⋅n=−1−1−1=−3signed numeratorD=∣−3∣3=3positive distance\begin{aligned} \mathbf{n}&=(1,-1,1) && \text{same directions}\\ \mathbf{b}-\mathbf{a}&=(-1,1,-1) && \text{new point displacement}\\ (\mathbf{b}-\mathbf{a})\cdot\mathbf{n}&=-1-1-1=-3 && \text{signed numerator}\\ D&=\frac{|-3|}{\sqrt3}=\sqrt3 && \text{positive distance} \end{aligned}

Why this step? A negative projection tells you that the second line lies on the opposite side of the first line's parallel plane; it does not represent a negative gap.

Answer. 3\sqrt3.

Check. Replacing n\mathbf{n} with −n-\mathbf{n} changes the numerator's sign and leaves the distance unchanged.

Neither rescaling a valid normal nor reversing the joining vector can alter the distance.

Watch out

Wrong: using ∣b−a∣|\mathbf{b}-\mathbf{a}| as the skew-line distance. That measures one arbitrary joining segment. Right: take only its component in a direction perpendicular to both lines, using the scalar product and dividing by ∣n∣|\mathbf{n}|.

The opening cables therefore come within 3\sqrt3 units, however far apart the chosen starting points appear. Their separation is a projection, not an endpoint distance.

A point and a plane

For a plane, its normal already supplies the perpendicular direction. Measure how far the point's scalar product lies from the plane's constant, then divide by the normal's length.

For r⋅n=p\mathbf{r}\cdot\mathbf{n}=p and a given point b\mathbf{b}, take any plane point a\mathbf{a}. Since a⋅n=p\mathbf{a}\cdot\mathbf{n}=p, the joining vector's normal component is

(b−a)⋅n∣n∣=b⋅n−p∣n∣\frac{(\mathbf{b}-\mathbf{a})\cdot\mathbf{n}}{|\mathbf{n}|} =\frac{\mathbf{b}\cdot\mathbf{n}-p}{|\mathbf{n}|}

Its magnitude is the perpendicular distance. This is the same projection idea as the skew-line formula, with the normal provided directly by the plane.

Distance from a point to a plane

For a point with position vector b\mathbf{b} and a plane r⋅n=p\mathbf{r}\cdot\mathbf{n}=p, where n≠0\mathbf{n}\ne\mathbf{0},

D=∣b⋅n−p∣∣n∣D=\frac{|\mathbf{b}\cdot\mathbf{n}-p|}{|\mathbf{n}|}

In the formula booklet.

For ax+by+cz=dax+by+cz=d, this is D=∣ax1+by1+cz1−d∣/a2+b2+c2D=|ax_1+by_1+cz_1-d|/\sqrt{a^2+b^2+c^2}; that coordinate expression follows by expanding the supplied vector formula. It gives zero for a point in the plane. Rescaling the whole plane equation multiplies numerator and denominator by the same absolute factor, leaving the distance unchanged.

Worked example 9: a cartesian plane

Question. Find the distance from B(1,2,4)B(1,2,4) to 2x−y+2z=52x-y+2z=5.

Plan. Read the normal and constant, then apply the supplied formula.

n=(2,−1,2),p=5plane datab⋅n−p=2−2+8−5=3constraint differenceD=∣3∣4+1+4=1divide by normal length\begin{aligned} \mathbf{n}&=(2,-1,2),\quad p=5 && \text{plane data}\\ \mathbf{b}\cdot\mathbf{n}-p&=2-2+8-5=3 && \text{constraint difference}\\ D&=\frac{|3|}{\sqrt{4+1+4}}=1 && \text{divide by normal length} \end{aligned}

Why this step? The number 3 is the change in the plane expression, not yet a distance. The normal has length 3, so each unit of perpendicular travel changes that expression by 3.

Answer. D=1D=1.

Check. The foot is B−13n=(1/3,7/3,10/3)B-\frac13\mathbf{n}=(1/3,7/3,10/3); it lies on the plane and is 1 unit from BB.

Worked example 10 changes one feature: the point's height drops from 4 to 1, putting it on the other side of the plane.

Worked example 10: the other side of the plane

Question. Find the distance from C(1,2,1)C(1,2,1) to 2x−y+2z=52x-y+2z=5.

Plan. Evaluate the new signed constraint difference, then take its absolute value.

c⋅n−p=2−2+2−5=−3new pointD=∣−3∣3=1non-negative distanceF=C+13(2,−1,2)=(53,53,53)normal foot check\begin{aligned} \mathbf{c}\cdot\mathbf{n}-p&=2-2+2-5=-3 && \text{new point}\\ D&=\frac{|-3|}{3}=1 && \text{non-negative distance}\\ F&=C+\frac13(2,-1,2)=\left(\frac53,\frac53,\frac53\right) && \text{normal foot check} \end{aligned}

Why this step? The sign tells you which way to travel along the normal to reach the plane. The modulus gives the distance on either side.

Answer. D=1D=1.

Check. 2(5/3)−5/3+2(5/3)=52(5/3)-5/3+2(5/3)=5, and ∣F−C∣=∣(2,−1,2)/3∣=1|F-C|=|(2,-1,2)/3|=1.

If the plane is given in parametric form, first find a normal and its constant as in the planes lesson. Only then apply the distance formula.

Watch out

Wrong: dividing by n⋅n\mathbf{n}\cdot\mathbf{n} in the distance formula. That quantity occurs when finding a foot's parameter. Right: divide by ∣n∣|\mathbf{n}| to obtain a distance.

Choose the data before the formula: point-line in two dimensions uses its cartesian constraint; point-line in space and parallel lines use a perpendicular foot; skew lines use a common normal; point-plane uses the plane normal. Each route measures a perpendicular component, so each has the same geometric reason for giving the minimum.

Quick Recap

  • A shortest joining segment is perpendicular; an arbitrary starting-point distance usually overestimates it.
  • For a point and a line in space, find the foot using a zero scalar product, then take the joining vector's magnitude.
  • Parallel lines reduce to a point-line problem; skew lines use the component along a common perpendicular.
  • Point-line in two dimensions, skew-line and point-plane distance formulae are supplied; identify their signed constants carefully.
  • Moduli make distances non-negative, and scaling a valid normal changes neither the plane nor the distance when the whole expression is scaled consistently.

The opening skew lines have separation 3\sqrt3, obtained by projecting their starting-point displacement onto (1,−1,1)(1,-1,1).