Distance from a point to a straight line in space

The distance between a point P and a straight line r, 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 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, v. The area of the parallelogram determined by the vector QP and v has module equal to the vector product of both vectors: Sp=|QP×v|

But the area of a parallelogram is also given by the product of the base times the height. Then: |Sp=|v|d(P,r)

Therefore, d(P,r)=|QP×v||v|

Example

Calculate the distance between the point P=(2,4,1) and the straight line r:(x,y,z)=(2,3,1)+k(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 QP and v.

QP=(0,1,2)

|QP×v|=||ijk012121||=|i+2jk4i|=|3i+2jk|=|(3,2,1)|=9+4+1=14

and we can already apply the formula:

d(P,r)=|QP×v||v|=146=73