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 dl: \ \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=QP\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 = (PQddd)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 = PQprojd 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)=perpdPQ\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=QP\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 = (PQnnn)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+t1,1,2l_1:\ \lang x,y,z\rang=\lang4,11,5\rang+t\lang1,1,-2\rang

l2: x,y,z=0,9,8+s1,1,2l_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 d2=d1\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,84,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=(PQddd)d=(4,2,31,1,21,1,21,1,2)1,1,2=1261,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  =  PQprojd PQ=  4,2,32,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 Π: x3yz=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,26,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=(PAnnn)n=(7,1,21,3,11,3,11,3,1)1,3,1=2111,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 5xy2z=65x-y-2z=6 and 5xy2z=45x-y-2z=-4.
Extra Practice