# 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.

What you did seems to me like using a sledgehammer to crack a nut.

It might help you to try and approach this problem a bit more geometrically: if you have a straight line and a parallel plane, do you know how to calculate the distance between those?

Can you possibly write down the equation of a plane which goes through one of your lines and is parallel to the other?

• I agree with you but this is actually a homework optimization problem that we are supposed to solve analytically – IronMan12 Oct 20 '14 at 15:58
• In that case, you'll probably be stuck with doing calculus. Sympathies. Could you possibly give a slightly more detailed outline of what you did? I just sketched the problem and it wasn't terribly much work, but I have no idea where you deviated from what you should have been doing. Alternatively, I could just post a solution, but that may take until tomorrow because typing equations in LaTeX is a pain if you're not used to it... – Some Math Student Oct 20 '14 at 21:20