# Distance between a straight line and a plane in space

Notice the relative positions between a straight line $$r$$ and a plane $$\pi$$ to calculate the distance between them:

• If the straight line is included in the plane or if the straight line and the planes are secant, the distance between both is zero, $$\text{d}(r,\pi)= 0$$
• If the straight line and the plane are parallel, the distance between both is calculated taking a point $$P$$ of the straight line and calculating the distance between $$P$$ and the plane. $$\text{d}(r,\pi)=\text{d}(P,\pi) \quad \text{ where } P\in r$$$Find the distance between the straight line $$r:x-2=y=z+1$$ and the plane $$\pi:x+y-2z+3=0$$. We verify that the plane and the straight line are parallel using the scalar product between the governing vector of the straight line, $$\vec{v}$$, and the normal vector of the plane $$\vec{n}$$. If the straight line and the plane are parallel the scalar product will be zero: $$\vec{v}\cdot\vec{n}=(1,1,1)\cdot(1,1,-2)=1+1-2=0$$$

So they are parallel. We look for a point of the straight line, $$Q=(2,0,-1)$$, and apply the formula: $$\text{d}(r,\pi)=\text{d}(P,\pi)=\dfrac{|1\cdot2+1\cdot0-2\cdot(-1)+3|} {\sqrt{1^2+1^2+(-2)^2}}=\dfrac{7}{\sqrt{6}}$$\$