# Distance between point and a line [duplicate]

Hello can I get help with this question?

Compute the distance between the point $R(1, 1, 1)$ and the line $$\begin{bmatrix} 0 \\ -1 \\ 1 \\ \end{bmatrix} + t \begin{bmatrix} 1 \\ -2 \\ 2 \\ \end{bmatrix}$$

For what I visualized: If so, $|\vec{u}\ \times\ \vec{PR}|=|u||PR|\sin\angle QPR=|u||QR|$. We have $\vec{PR}=(1,2,0),\vec{u}=(1,-2,2)$, so $|\vec{u}\ \times\ \vec{PR}|=|(4,-2,-4)|=6$ and hence $|QR|=\frac{6}{|u|}=\frac{6}{3}=2$.
Alternatively, suppose $Q$ is the point with parameter $t$ and hence coordinates $(t,-1-2t,1+2t)$. Then $\vec{QR}=(t-1,-2-2t,2t)$, so $\vec{u}\cdot\vec{QR}=t-1+4+4t+4t=9t+3$. This must be 0 since they are perpendicular, so $t=-\frac{1}{3}$. Hence $Q$ is $(-\frac{1}{3},-\frac{1}{3},\frac{1}{3})$ and $|QR|^2=\left(\frac{4}{3}\right)^2+\left(\frac{4}{3}\right)^2+\left(\frac{2}{3}\right)^2=4$,so $|QR|=2$.
The projection $Q$ of $R$ on the line directed by $\vec u$ is: $$Q=P+\frac{\langle\overrightarrow{PR},\vec u\rangle}{\langle\vec u,\vec u\rangle}\,\vec u$$ and the distance $d$ is defined by $$d^2=\lVert PR \rVert^2-\lVert PQ \rVert^2=\lVert PR \rVert^2-\frac{\langle\overrightarrow{PR},\vec u\rangle^2}{\langle\vec u,\vec u\rangle}.$$