# Logic behind the formula for distance between a point and a line

I just watched a YouTube video that used a neat formula, but I don't understand why it works.

Question:

Find the distance between the point $(4,1,-2)$ and the following line $$\begin{cases} x(t) = 1 + t \\ y(t) = 3 - 2t \\ z(t) = 4 - 3t \\ \end{cases}$$

Vector $a = (1,-2,-3)$

When we substitute in the line $t = 0$, we get the point $(1,3,4)$ on the line.

We then subtract the point $(4,1,-2)$ and $(1,3,4)$ to get another vector, lets call it vector $b$.

So, vector $b = (3,-2,-6)$

This is the formula that is confusing to me:

$$d = \frac{|a\times b|}{|a|}$$ where $d$ is the distance

So I understand that $|a\times b|$ evaluates to magnitude of the vector orthogonal to both vector $a$ and vector $b$ and $|a|$ will evaluate to the magnitude of vector $a$

But my question is: why does this formula works? And why must $|a|$ be the denominator instead of $|b|$?

Because $$\frac{|a\times b|}{|b|}=|a|\sin\alpha.$$

Draw it!

Let $B(1,3,4),$ $A(4,1,-2)$, $\vec{BC}=\vec{a}$, $\vec{BA}=\vec{b}$ and $D\in(ABC)$ such that $BD\perp BC$ and $AD\perp BD$.

Also, let $\measuredangle ABC=\alpha$.

Thus, $$BD=|\vec{b}|\sin\alpha=\frac{|\vec{a}\times \vec{b}|}{|\vec{b}|},$$ which is exactly needed distance.

You are given a point $B$ from which to find the distance.

First you find the direction vector of the line, which is $\vec a$, not caring about its magnitude.

Next you find a point $C$ on the line, by setting $t=0$ and the vector $\vec b$ from $C$ to $B$

Now let $D$ be the foot of the perpendicular from $B$ to the line so that $BCD$ is a right-angled triangle, and let $\theta$ be the angle at $C$ so that $BD = BC\sin \theta$ and this is the distance you want.

Consider now $\vec b \times \vec a = (BC |\vec a|\sin \theta)\ \vec n$ where $\vec n$ is the appropriate unit normal to the plane in which the triangle sits. To get what you want you need the magnitude of this vector divided by $|\vec a|$.

$|\vec a|$ is in the denominator because really you want a unit vector in the direction of the line - the distance doesn't depend on $|\vec a|$ but $|\vec b|$ is one side of a right-angled triangle and the lengths of the other sides are proportional to this (given fixed angles).

In the end if is because $\cfrac {\vec a}{|\vec a|}$ is a unit vector in the direction of the line - and all you need $\vec a$ for is to determine $\sin \theta$ - you need direction, but not magnitude.

$$|a\times b|=|a||b|\sin\theta$$ where $\theta$ is the angle between the vectors.

The distance you are looking for is $$d:=|b||\sin\theta|,$$ the length of the projection of $b$ in the direction parallel to $a$, from which the claim.

Said differently, you are making $a$ a unit vector by normalizing as

$$\frac a{|a|}$$ and compute the length of the projection of $b$

$$d=\left|\frac a{|a|}\times b\right|=\frac{|a\times b|}{|a|}.$$

The key to understanding this is that $|a\times b|$ is the area of the parallelogram with sides $a$ and $b$. You can find many proofs of this with a quick Internet search. As Michael Rozenberg writes: draw it! The vector $a$ is a direction vector of the line, and the vector $b$ goes from the point at $t=0$ to the point $P$ to which you’re measuring the distance. The area of the shaded paralellogram is $|a\times b|$, which is also equal to the length of one side times the height of the paralellogram measured perpendicularly to that side. If you take $a$ as the base, then this perpendicular distance is exactly the distance to the point $P$ that you’re trying to find, from which you get the formula ${|a\times b|\over|a|}$. If you were to put $|b|$ in the denominator instead, you’d be measuring the height relative to $|b|$ which isn’t the distance that you’re looking for.