0:00 / 0:00

Distances

Distance Between a Point and a Line

To calculate the shortest distance between a point and a line we use the perpendicular perp\text{perp}(based on the projection proj\text{proj}).

Given a point Q(q1,q2,…,qn)Q(q_1, q_2, \dots, q_n) and a line in vector form l: x⃗=P⃗+t d⃗l: \ \vec x = \vec P + t\ \vec d, the distance from point QQ to line ll is given by:
distance(Q,l)=∥perpd⃗ PQ→∥\boxed{\quad \text{distance}(Q,l) = \left\lVert \text{perp}_{\displaystyle \vec d}\ \overrightarrow{PQ} \right\rVert \quad}
Steps
  1. Find the vector PQ→=Q⃗−P⃗\overrightarrow{PQ} = \vec Q - \vec P
  2. Find the projection of PQ→\overrightarrow{PQ} onto the line's direction vector d⃗\vec{d}: projd⃗ PQ→ = (PQ→⋅d⃗d⃗⋅d⃗)d⃗\text{proj}_{\displaystyle \vec d}\ \overrightarrow{PQ} \ =\ \left(\dfrac{\overrightarrow{PQ} \cdot \vec d}{\vec d \cdot \vec d}\right) \vec d
  3. Find the perpendicular vector: perpd⃗ PQ→ = PQ→−projd⃗ PQ→\text{perp}_{\displaystyle \vec d} \ \overrightarrow{PQ} \ =\ \overrightarrow{PQ}-\text{proj}_{\displaystyle \vec{d}}\ \overrightarrow{PQ}
  4. The shortest distance from point QQ to line ll is the norm of the perpendicular: distance(Q,l)=∥perpd⃗PQ→∥\text{distance}(Q,l) = \left\lVert \text{perp}_{\displaystyle \vec d} \overrightarrow{PQ} \right\rVert
Wize Tip
These same steps can be used to find the shortest distance between a line and a second parallel line:
→\rightarrow Choose any point on the second line and call it QQ.

PAGE BREAK
Geometrically



PAGE BREAK

Distance Between a Point and a Hyperplane

We use a slightly different method to find the shortest distance between a point and a hyperplane in Rn\reals^n.
Given a point Q(q1,q2,…,qn)Q(q_1, q_2, \dots, q_n) and a plane in standard form Π: a1x1+a2x2+⋯+anxn=b\Pi: \ a_1 x_1 + a_2 x_2 + \dots + a_n x_n = b, the distance from point QQ to plane Π\Pi is given by:

distance(Q,Π)=∥projn⃗ PQ→∥\boxed{\quad \text{distance}(Q,\Pi) = \lVert \text{proj}_{\displaystyle \vec{n}}\ \overrightarrow{PQ} \rVert \quad}

Steps
  1. Find any point PP on the plane (it's often easiest to let all but one component be 0 and solve for the third).
  2. Find the vector PQ→=Q⃗−P⃗\overrightarrow{PQ} = \vec Q - \vec P
  3. Find the projection of PQ→\overrightarrow{PQ} onto the hyperplane's normal vector n⃗=⟨a1,a2,…,an⟩\vec{n} = \lang a_1, a_2, \dots, a_n\rang : projn⃗ PQ→ = (PQ→⋅n⃗n⃗⋅n⃗)n⃗\text{proj}_{\displaystyle \vec n}\ \overrightarrow{PQ} \ =\ \left(\dfrac{\overrightarrow{PQ} \cdot \vec n}{\vec n \cdot \vec n}\right) \vec n
  4. The shortest distance from point QQ to hyperplane Π\Pi is the norm of the projection: distance(Q,Π)=∥projn⃗ PQ→∥\text{distance}(Q, \Pi) = \left\lVert \text{proj}_{\displaystyle \vec n}\ \overrightarrow{PQ} \right\rVert
Wize Tip
These same steps can be used to find the distance between a plane and:
  • a parallel line, or
  • a second parallel plane
→\rightarrow Choose any point on the line or second plane and call it QQ.

PAGE BREAK
Geometrically




0:00 / 0:00

Example: Distance Between Parallel Lines

Find the shortest distance between the parallel lines:
l1: ⟨x,y,z⟩=⟨4,11,5⟩+t⟨1,1,−2⟩l_1:\ \lang x,y,z\rang=\lang4,11,5\rang+t\lang1,1,-2\rang

l2: ⟨x,y,z⟩=⟨0,9,8⟩+s⟨−1,−1,2⟩l_2:\ \lang x,y,z \rang = \lang 0,9,8\rang + s\lang -1,-1,2 \rang

Watch Out!
We may use the method of finding the distance between a point and a line.
This only works for finding the distance between two lines when they are parallel/collinear.

Distance Between Parallel Lines

Note that the direction vector d⃗2=−d⃗1\vec d_2 = -\vec d_1, so the lines are indeed collinear. ✓\colorThree{\checkmark}
Since the lines are parallel, we can use any point on l2l_2: choose Q(0,9,8)Q(0,9,8).
Then the problem boils down to finding the distance between point QQ and line l1l_1. (We can forget about l2l_2 entirely!)

Distance Between a Point and a Line

Choose any point on l1l_1: P(4,11,5)P(4,11,5)
PQ→=⟨0,9,8⟩−⟨4,11,5⟩=⟨−4,−2,3⟩\overrightarrow{PQ}=\lang 0,9,8\rang-\lang 4,11,5\rang = \lang -4,-2,3\rang
Find the projection of PQ→\overrightarrow{PQ} onto the direction vector of the line d⃗=⟨1,1,−2⟩\vec{d}=\lang 1,1,-2 \rang:
projd⃗ PQ→=(PQ→⋅d⃗d⃗⋅d⃗)d⃗=(⟨−4,−2,3⟩⋅⟨1,1,−2⟩⟨1,1,−2⟩⋅⟨1,1,−2⟩)⟨1,1,−2⟩=−126⟨1,1,−2⟩=⟨−2,−2,4⟩\begin{aligned} \text{proj}_{\displaystyle \vec{d}}\ \overrightarrow{PQ} &= \left( \dfrac{\overrightarrow{PQ}\cdot\vec d}{\vec d \cdot \vec d} \right) \vec d\\[1em] &= \left( \dfrac{\lang-4,-2,3\rang\cdot\lang1,1,-2\rang}{\lang1,1,-2\rang \cdot \lang 1,1,-2\rang} \right) \lang 1,1,-2\rang\\[1em] &=\dfrac{-12}{6} \lang 1,1,-2 \rang\\[1em] &= \lang -2,-2,4 \rang\\[1em] \end{aligned}
Subtract the projection from PQ→\overrightarrow{PQ} to find the perpendicular vector:
perpd⃗ PQ→  =  PQ→−projd⃗ PQ→=  ⟨−4,−2,3⟩−⟨−2,−2,4⟩=  ⟨−2,0,−1⟩\begin{aligned} \text{perp}_{\displaystyle \vec{d}}\ \overrightarrow{PQ} \ \ &=\ \ \overrightarrow{PQ} - \text{proj}_{\displaystyle \vec{d}}\ \overrightarrow{PQ}\\[0.5em] &=\ \ \lang -4,-2,3\rang -\lang -2,-2,4 \rang\\[0.5em] &=\ \ \lang -2,0,-1\rang \end{aligned}


The norm of this vector is the shortest distance between the parallel lines:
∥perpd⃗ PQ→∥=∥⟨−2,0,−1⟩∥=(−2)2+02+(−1)2=5\begin{aligned} \left\lVert \text{perp}_{\displaystyle \vec{d}}\ \overrightarrow{PQ} \right\rVert &= \lVert \lang -2,0,-1\rang \rVert\\ &= \sqrt{(-2)^2 + 0^2 +(-1)^2}\\ &= \boxed{\sqrt5} \end{aligned}


0:00 / 0:00

Example: Distance Between a Point and a Plane

Find the shortest distance between the plane Π: x−3y−z=−6\Pi: \ x-3y-z=-6 and the point A(1,1,2)A(1,1,2).

The normal vector to the plane can be read from the LHS: n⃗=⟨1,−3,−1⟩\vec{n}= \lang 1,-3,-1 \rang

1. Choose any point on the plane:
Setting y=z=0y=z=0 we can easily solve to find x=−6x=-6 . This gives us the point P(−6,0,0)P(-6,0,0).
2. Find PA→=⟨1,1,2⟩−⟨−6,0,0⟩=⟨7,1,2⟩\overrightarrow{PA} =\lang 1,1,2\rang - \lang -6,0,0\rang =\lang 7,1,2 \rang
3. Project PA→\overrightarrow{PA} onto n⃗\vec{n}:

projn⃗ PA→=(PA→⋅n⃗n⃗⋅n⃗)n⃗=(⟨7,1,2⟩⋅⟨1,−3,−1⟩⟨1,−3,−1⟩⋅⟨1,−3,−1⟩)⟨1,−3,−1⟩=211⟨1,−3,−1⟩=⟨211, −611, −211⟩\begin{aligned} \text{proj}_{\displaystyle \vec{n}}\ \overrightarrow{PA} &= \left( \dfrac{\overrightarrow{PA}\cdot\vec n}{\vec n \cdot \vec n} \right) \vec n\\[1em] &= \left( \dfrac{\lang 7,1,2\rang\cdot\lang 1,-3,-1\rang}{\lang 1,-3,-1\rang \cdot \lang 1,-3,-1\rang} \right)\lang 1,-3,-1\rang\\[1em] &=\frac{2}{11}\lang 1,-3,-1\rang\\[1em] &= \left\lang \dfrac{2}{11},\ -\dfrac{6}{11},\ -\dfrac{2}{11}\right\rang\\[1em] \end{aligned}

4. The norm of this vector is the distance between AA and the plane:

distance(A,Π)=∥⟨211,−611,−211⟩∥=(211)2+(−611)2+(−211)2=4+36+4121=4411=21111\begin{array}{rcl} \text{distance}(A, \Pi)&=&\left\lVert \left\lang \dfrac{2}{11},-\dfrac{6}{11},-\dfrac{2}{11}\right\rang \right\rVert\\[1em] &=& \sqrt{\left(\dfrac{2}{11}\right)^2 + \left(-\dfrac{6}{11}\right)^2 + \left(-\dfrac{2}{11}\right)^2}\\[1em] &=& \sqrt{\dfrac{4+36+4}{121}}\\[1em] &=&\dfrac{\sqrt{44}}{11}\\[1em] &=&\dfrac{2\sqrt{11}}{11}\\[1em] \end{array}

Practice: Distance Between a Point and a Line

Find the distance between the point P(12,7,−8)P(12,7,-8) and the line that passes through the points A(13,7,−13)A(13,7,-13) and B(19,7,−10)B(19,7,-10).

Practice: Distance Between Parallel Planes

Find the distance between the two parallel planes 5x−y−2z=65x-y-2z=6 and 5x−y−2z=−45x-y-2z=-4.
Extra Practice