The distance between a point $$P$$ and a straight line $$r$$, $$\text{d}(P,r)$$ is the minimal distance between $$P$$ and any point of the straight line $$r$$.

- If $$P$$ is a point of the straight line $$r$$, the distance is zero.
- If $$P$$ is not on the straight line $$r$$, the distance from $$P$$ to $$r$$ will be the module of the vector $$\overrightarrow{PP'}$$, where $$P'$$ is the orthogonal projection of $$P$$ on the straight line $$r$$.

Nevertheless, there exists a simpler way to calculate the distance between a point $$P$$ and a straight line $$r$$ if the point does not belong to the straight line. Let's consider a point $$Q$$ on the straight line $$r$$ and the governing vector of the straight line, $$\vec{v}$$. The area of the parallelogram determined by the vector $$\overrightarrow{QP}$$ and $$\vec{v}$$ has module equal to the vector product of both vectors: $$$S_p=|\overrightarrow{QP}\times\vec{v}|$$$

But the area of a parallelogram is also given by the product of the base times the height. Then: $$$|S_p=|\vec{v}|\cdot\text{d}(P,r)$$$

Therefore, $$$\text{d}(P,r)=\dfrac{|\overrightarrow{QP}\times\vec{v}|}{|\vec{v}|}$$$

Calculate the distance between the point $$P = (2, 4, 1)$$ and the straight line $$r: (x, y, z) = (2, 3, -1) + k\cdot(1, 2, 1)$$.

We take a point of the straight line, for example $$Q = (2, 3, -1)$$. Now we will have to calculate the vector product of the vectors $$\overrightarrow{QP}$$ and $$\vec{v}$$.

$$\overrightarrow{QP}=(0,1,2)$$

$$\begin{array}{rl} |\overrightarrow{QP}\times\vec{v}|=& \left| \begin{vmatrix} i & j & k \\ 0& 1& 2 \\ 1& 2& 1 \end{vmatrix} \right| = |i+2j-k-4i|=|-3i+2j-k| \\ =& |(-3,2,-1)|=\sqrt{9+4+1}=\sqrt{14} \end{array}$$

and we can already apply the formula:

$$$\text{d}(P,r)=\dfrac{|\overrightarrow{QP}\times\vec{v}|}{|\vec{v}|}= \dfrac{\sqrt{14}}{\sqrt{6}}=\sqrt{\dfrac{7}{3}}$$$