# Finding the minimum distance between two lines

I really don't know how to tackle this optimization problem: We consider the two lines

$$a(x) = x \begin{pmatrix}1\\2\\3\end{pmatrix}, b(y) = \begin{pmatrix}\alpha\\\beta\\\gamma\end{pmatrix}+y\begin{pmatrix}3\\2\\1\end{pmatrix}$$

where $\alpha,\beta,\gamma$ are real numbers. I want to find the closest distance between the two lines. In order to do that I want to minimize the (convex) function $$f(x,y)= || b(y) - a(x)||^2$$

My attempt: Introduce the functions $$c(x,y) = b(y) - a(x) = \begin{pmatrix}\alpha + 3y -x\\\beta+2y-2x\\\gamma+y-3x\end{pmatrix}$$ and $$d(z) = ||z||^2$$

Then $$f(x,y) = d \circ c(x,y)$$

Calculating the first-order partial derivatives:

$$J(d \circ c)(x,y) = Jd(c(x,y)) \hspace{0.1cm} Jc(x,y)= 2 \ c(x,y)^T \hspace{0.1cm} Jc(x,y)$$

Now I calculated the partial derivatives but I got very ugly terms and I failed to find the critical points and I don't think I am on the right track.