Shortest distance between helix and line?

What is the shortest distance between the helix with parametric equations: $$x = \cos u, \quad y = \sin u, \quad z = \tfrac{2}{\sqrt{\pi}}u\qquad \text{ for }u \in\mathbb{R}$$ and the line $$x + y = \sqrt{2},\quad z = −\sqrt{\pi}$$

What are the steps that should be followed in solving this problem or other similar ones?

• Write the parametric equation of the line, say as a function of a prameter $v$ and write the expression of the (squared) Euclidean distance between a point of the helix and a point of the line. You will find the extrema by canceling the derivatives on $u$ and $v$. – Yves Daoust Sep 4 '16 at 21:54

We have

$$\vec{\mathbf{h}}(u) = \begin{bmatrix} \cos u \\ \sin u \\ \frac{2}{\sqrt{\pi}} u\end{bmatrix} \quad \quad \vec{\mathbf{g}}(v) = \begin{bmatrix} v \\ \sqrt{2} - v \\ -\sqrt{\pi} \end{bmatrix}$$

$$d(u, v) = \sqrt{(\cos u - v)^2 + (\sin u + v - \sqrt{2})^2 + (\frac{2}{\sqrt{\pi}}u + \sqrt{\pi})^2}$$

Differentiating with respect to $u$ and setting the numerator equal to $0$ gives

$$v\sin u + (v - \sqrt{2}) \cos u + \frac{4}{\pi} u + 2 = 0$$

Differentiating with respect to $v$ and setting the numerator to $0$ gives

$$\sin u - \cos u = \sqrt{2} - 2v$$

A systematic approach to solving this would be quite messy, but fortunately we're humans and not computers. We notice in the first equation that setting $v = \sqrt{2}$ makes the second term 0. We see

$$\sqrt{2} \sin u = - (\frac{4}{\pi} u + 2)$$

To cancel out the $\sqrt{2}$ we try $u = \sin \frac{\pi}{4}$. This doesn't quite work but we see trying $u = -\frac{\pi}{4}$ does work.

We notice that this guess also satisfies the second equation. The critical point to test is thus $$(u, v) = (-\frac{\pi}{4}, \sqrt{2})$$

After confirming this is a minimum, evaluating the distance at this point gives the shortest distance of

$$d(-\frac{\pi}{4}, \sqrt{2}) = \frac{\sqrt{\pi + 4}}{2}$$

You need to minimize

$$d^2=(\cos u-v)^2+(\sin u-\sqrt2+v)^2+\left(\frac2{\sqrt\pi}u+\sqrt\pi\right)^2.$$

Defferentiating on $u$ and $v$, $$-2\sin u(\cos u-v)+2\cos u(\sin u-\sqrt 2+v)+2\left(\frac2{\sqrt\pi}u+\sqrt\pi\right)=0,\\ -2(\cos u-v)+2(\sin u-\sqrt2+v)=0.$$

You can solve one of the equations for $v$ and plug in the other. I don't think that a closed-form solution is possible.

• It turns out there is a closed form, but only just: Solving the second equation for $v$ and plugging into the first gives an equation that can be rearranged to $$\frac{8}{\pi}u+4=\sqrt{2}\cos u-\cos^2 u-\sqrt{2}\sin u+\sin^2 u.$$ This happens to have a single real root at $u=-\pi/4$. – Semiclassical Sep 4 '16 at 23:11
• @Semiclassical: yep, they chose the coefficients on purpose. – Yves Daoust Sep 5 '16 at 6:53

Here's an outline of a solution:

1. Find a general formula for the shortest distance (i.e., perpendicular distance) between a given point $(a, b, c)$ and the line $x+y = \sqrt{2}$, $z = -\sqrt{\pi}$.

2. Assume further that your point $(a, b, c)$ lies on the helix, so it has the form $\left(\cos u, \sin u, \frac{2}{\pi}u\right)$. This will give you a function $d:\mathbb{R}\to\mathbb{R}$ which gives you the shortest distance between $\left(\cos u, \sin u, \frac{2}{\pi}u\right)$ and the line.

3. Now you can use calculus techniques (i.e., the derivative of $d$) to find the minimum value of $d(u)$, and the value(s) for $u$ where the minimum occurs.