# Shortest distance between any two curves

In general, if given equation of any two curves, how to find the shortest distance?

According to me, finding common normal won't work as it isn't necessary for both of them to have one like in case of domain bounded functions.

We can take a more general approach i.e. by assuming points on both the curves, forming the expression for distance between the points and then minimizing it using partial derivatives.

Though the latter approach is reliable but too lengthy and many a times it produces equations quite difficult to solve especially in case of conics. Isn't there a better method?

Thank you!

• Have you tried to write the space curves parametrically and then minimize $|\vec r_1(t_1)-\vec r_2(t_2)|$ over all $t_1$ and $t_2$? – Mark Viola Feb 2 at 3:56
• I don't think I know how to do it (converting algebraic equations to vector form) . It would be great if you could cite a source for learning that! – Username Feb 2 at 4:00
• Could you give an example you consider to be difficult ? I would enjoy working it. Cheers. – Claude Leibovici Feb 2 at 14:18

The basic answer is NO.

However, the problem becomes much simpler is you minimize the square of the distance; this will give you the same result.

If the problem is still too difficult, make a grid search (only two parameters in $$2D$$) and zoom more and more around the minimum. Similar to this, you could make a contour plot of the distance as a function of $$x_1$$ and $$x_2$$.

If you have a difficult problem as an example, feel free to post it.

• (+1) Salut Claude, mon amie. – Mark Viola Feb 2 at 4:28
• @MarkViola. Hi Mark ! Good to see you. Thanks. :-) – Claude Leibovici Feb 2 at 4:31
• Et vous. Je vous an price. – Mark Viola Feb 2 at 4:36