<s>[INST] 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?
 [/INST] 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}$$
</s>