This is an old revision of the document!
Warning: Undefined array key "do" in /home/levene/public_html/w/mst10030/lib/plugins/revealjs/syntax/header.php on line 56
Warning: Undefined array key "do" in /home/levene/public_html/w/mst10030/lib/plugins/revealjs/syntax/header.php on line 56
Warning: Undefined array key "do" in /home/levene/public_html/w/mst10030/lib/plugins/revealjs/syntax/header.php on line 56
Warning: Undefined array key "do" in /home/levene/public_html/w/mst10030/lib/plugins/revealjs/syntax/header.php on line 56
Warning: Undefined array key "do" in /home/levene/public_html/w/mst10030/lib/plugins/revealjs/action.php on line 14
The distance from a point to a line
Suppose $L$ is a line in $\def\rt{\mathbb{R}^3}\def\rn{\mathbb{R}^n}\rt$. Let $A$ be a point on $L$ and let $\def\vv{\vec v}\vv$ be a direction vector along $L$.
Given a point $B$, how can we find $d=\text{dist}(B,L)$, the (shortest) distance from the point $B$ to the line $L$?
Let $A$ be any point in $L$ and let $\theta$ be the angle between $AB$ and $\vv$. We have \[ d=\|\vec{AB}\|\,\sin \theta = \frac{\|\vec{AB}\|\,\|\vv\|\sin \theta}{\|\vv\|} = \frac{\|\vec{AB}\times \vv\|}{\|\vv\|}.\] So \[ \text{dist}(B,L) = \frac{\|\vec{AB}\times \vv\|}{\|\vv\|}\] where $A$ is any point in $L$.
Example
To find the distance from the point $B=(1,2,3)$ to the line \[L:\def\c#1#2#3{\begin{bmatrix}#1\\#2\\#3\end{bmatrix}}\c xyz=\c10{-1}+t\c41{-5},\quad t\in\mathbb{R}\] we can choose $A=\c10{-1}$ so that $\vec{AB}=\c024$ and taking $\vv=\c41{-5}$, we obtain \[ \vec{AB}\times \vv = \begin{vmatrix}\vec\imath&\vec\jmath&\vec k\\0&2&4\\4&1&-5\end{vmatrix}=\c{-14}{16}{-8}=2\c{-7}{8}{-4}\] so \[ \def\dist{\text{dist}}\dist(B,L)=\frac{\|\vec{AB}\times\vv\|}{\|\vv\|}=\frac{2\sqrt{7^2+8^2+4^2}}{\sqrt{4^2+1^2+5^2}} = \frac{2\sqrt{129}}{\sqrt{42}} \approx 3.5051.\]
Alternative method
The method above relies on the cross product, so only works in $\rt$. The following alternative method works in $\rn$ for any $n$.
Observe that $\dist(B,L)$ is the length of the vector $\def\nn{\vec n}\nn=\vec{AB}-\def\pp{\vec p}\pp$ where $\pp=\def\proj{\text{proj}}\proj_{\vv}\vec{AB}$.
Example
Let's redo the previous example using this method.
We have $\vec{AB}=\c024$ and $\vv=\c41{-5}$, so \[\pp=\proj_{\vv}\vec{AB} = \left(\frac{\vec{AB}\cdot \vv}{\|\vv\|^2}\right)\vv = \frac{0(4)+2(1)+4(-5)}{4^2+1^2+5^2}\c41{-5} = -\frac{18}{42}\c41{-5}=-\frac{3}{7}\c41{-5},\] so \[ \nn=\vec{AB}-\pp=\c024-(-\frac37)\c41{-5}=\c024+\frac37\c41{-5}=\frac17\c{12}{17}{13}\] so \[ \dist(B,L)=\|\nn\|=\frac17\sqrt{12^2+17^2+13^2} = \frac17\sqrt{602} \approx 3.5051.\]
