Given that $P=(x,x,x)$ and $Q=(y,3y,-1)$ are two lines in $\mathbb{R}^3$ then I need to express in matrix form $\|AX-b\|^2$ to find the distance between $P$ and $Q$. I need to find two points on this line which are closest to each other.
I tried like: $\begin{bmatrix}1&1&1\\ 3&1&0\end{bmatrix}\begin{bmatrix}x\\y\\z\end{bmatrix}=\begin{bmatrix}0\\3\end{bmatrix}$ but after that what I have to do? Thanks for helping
The squared Euclidean distance is
$$(x-y)^2+(x-3y)^2+(x-1)^2,$$ which you can write as
$$\left\|\begin{bmatrix}1&-1&0\\1&-3&0\\1&0&0\end{bmatrix}\begin{pmatrix}x\\y\\z\end{pmatrix}+\begin{pmatrix}0\\0\\-1\end{pmatrix}\right\|^2.$$