# Find distance from point to line

I am asked to find the distance between a point ( 5,1,1 ) and a line

$\displaystyle \left\{\begin{matrix} x + y + z = 0\\ x - 2y + z = 0 \end{matrix}\right.$

What ive done so far is to simplify by gauss elimination and I get to:

$\displaystyle \begin{bmatrix} 1 &1 &1 &0 \\ 0 &1 &0 &0 \end{bmatrix}$

In turn I put this back in the form of an equation

$\left\{\begin{matrix} x + y + z = 0\\ y = 0 \end{matrix}\right.$

What I need to find the distance between the point and line is any point on the line and a directional vector, right?

Am i right in assuming that we have

$\begin{pmatrix} x,y,z \end{pmatrix} = \begin{pmatrix} t,0,-t \end{pmatrix}$

So a point on this line could be (1,0,-1) or (12,0,-12)? If this is correct, how would I go on about finding the directional vector so I can put this all on the form of

$\begin{Vmatrix} \overrightarrow{PQ} \times \overrightarrow{v} \end{Vmatrix} \div \begin{Vmatrix} \overrightarrow{v} \end{Vmatrix}$

So to sum up, Q is given, the line is given in a system of equations, how do I extract a point P on the line and the vector v?

For $t=1$, a possible directional vector for your line is $(1,0,-1)$. The projection of $(5,1,1)$ onto $(1,0,-1)$ would be $(2,0,-2)$ and that is the closest point on the line, to $(5,1,1)$.

The distance would then be $|(5,1,1)-(2,0,-2)|$. The length of the rejection.

• I came to this answer before, | (5,1,1) - (2,0,-2) | = | (3,1,3) | = sqrt(19) but the key says the answer is sqrt(14) – darrrrUC Mar 11 '16 at 11:16
• @darrrrUC You’ve got two answers arrived at by different methods that both say $\sqrt{19}$, so it’s likely that either the answer key is wrong or there’s an error in your problem statement. – amd Mar 11 '16 at 21:45
• Yes, the key was wrong. Thanks! – darrrrUC Mar 12 '16 at 9:08

A variational method :

Let $(x,y,z)$ the point on the line the closest from $(5,1,1)$. The distance is $D$. $$D^2=(x-5)^2+(y-1)^2+(z-1)^2$$ For the smallest $D$, the differentiation leads to : $$(x-5)dx+(y-1)dy+(z-1)dz=0$$ And on the line : $$dx+dy+dz=0$$ $$dx-2dy+dz=0$$ This must be true any $dx,dy,dz$ so : $\begin{Vmatrix} 1 & 1 & 1 \\ 1 & -2 & 1 \\ (x-5) & (y-1) & (x-1) \end{Vmatrix} =0$ which leads to :

$$x-z=4$$

Note : instead of considering the determinant, one can eliminate $dx,dy,dz$ from the three above equations and obtain $x-z=4$ as well.

Then, solving : $\begin{cases} x+y+z=0 \\ x-2y+z=0 \\ x-z=4 \\ \end{cases}$ gives : $\begin{cases} x=2 \\ y=0 \\ z=-2 \\ \end{cases}$

$$D=\sqrt{ (2-5)^2+(0-1)^2+(-2-1)^2 } = \sqrt{19}$$