# Vector proof of shortest distance from a point to a line: flaw in my reasoning.

Let $$E$$ an euclidean plane, $$P$$ a point in $$E$$, and $$d$$ a straight line in $$E$$ with a fixed point $$A$$ and a direction vector $$\vec{V}$$ , so that any other point $$X \in d$$ can be described through a real parameter $$t$$ by $$\vec{AX}=t\vec{V}$$.

Consequently, we can write $$\vec{PX}=\vec{PA}+t\vec{V} \,\,\,\,\,\,\,\,\,\,\,\,\ [1]$$

In this mathexchange question, I have a problem with a proof to show the shortest distance from $$P$$ to $$d$$. In fact, I am able to calculate it by minimizing the quantity $$||\vec{PX}||^2$$ seen as a function of $$t$$. That expression is purely scalar so it's easy to avoid mistake when minimizing it through differentiation. But just out of curiosity I tried to get to the same result by minimizing $$\vec{PX}$$ instead of its square, and I have a problem: I can show the shortest distance is perpendicular, but I get the magnitude wrong. Here is the reasoning:

First I write $$\vec{PX}=|\vec{PX}|.e_{\vec{PX}}$$, where $$e$$ is the unit vector along the direction of $$\vec{PX}$$.

Minimizing equation $$[1]$$ with respect to $$t$$ means two things:

1/ First I must differentiate both sides of $$[1]$$: $$(\partial_t|\vec{PX}|).e_{\vec{PX}}+|\vec{PX}|.(\partial_te_{\vec{PX}})=0+\vec{V}\,\,\,\,\,[2]$$

2/ Now I impose the minimization condition on the distance: this means that the object $$\partial_t|\vec{PX}|=0$$, so the only part that survives in the expression $$[2]$$ is

$$|\vec{PX}|.(\partial_te_{\vec{PX}})=\vec{V}\,\,\,\,\,[3]$$

Now there is a reasoning of vector calculus that tells us that the differential of a unit vector is perpendicular to it. The LHS of $$[3]$$ tells us that $$\partial_te_{\vec{PX}}$$ is perpendiculat to $$\vec{PX}$$ but the RHS of $$[3]$$ tells us that this perpendicular object is also parallel to $$\vec{V}$$. Hence the shortest distance $$|\vec{PX}|$$ is perpendicular to the straight line $$d$$.

But then I get stuck and I don't see how to get the magnitude of that distance. At first I would want to write $$|\vec{PX}|=\frac{|\vec{V}|}{|\partial_te_{\vec{PX}}|} \,\,\,\,\,\, [4]$$

I do not see how to calculate the actual magnitude of $$|\vec{PX}|$$ from there. In fact, I suspect there is a mistake somewhere, because the direction vector $$\vec{V}$$ can be arbitrarily small or large, while $$\vec{PX}$$ is fixed by the geometry. I am probably missing something very silly. I have explained the problem the most clearly I can, any insight would be appreciated. Thanks.

• Excluding rigour, abuse of language and other similar things, I don't see any fundamental mistakes in your reasoning. To help clear up some of your confusion, do remember that the magnitude of $\partial_te_{\vec{PX}}$ depends on the magnitude of $\vec V$. I haven't checked if there's a simple way to proceed forward from your current reasoning. May 1 '19 at 15:42
• hi @N.Bach I am not surprised of the possible lack of rigour/mathematical language. My background is physicist so while the above text could be more than ok for a physicist, it could be less satsfying from a mathematical point of view. Please feel free to let me know suggestions to improve the way things are expressed. However I don't understand why or how $\partial_t e_{\vec{PX}}$ depends on the magnitude of $\vec{V}$? This might be the link I don't see? May 1 '19 at 15:51
• I kinda fall on the "annoying" end of the spectrum when it comes to rigour, so don't take it to heart... But since you asked, I'll mention the thing that bugs me the most. Throughout your post, there's some "confusion" between a vector and its norm/magnitude. For instance, it doesn't really make sense for a distance to be perpendicular to anything, though it does for a vector. Conversely, it is equivocal to talk about "minimizing a vector". In this context I assume it to mean "minimizing the norm of a vector", but in others, it's not so clear-cut, so I'd advise to avoid that expression. May 1 '19 at 18:50

Below are two(?) explanations to why $$\partial_te_{\vec{PX}}$$ depends on $$\vec V$$. The analytical one probably isn't very helpful to OP, but I didn't feel like erasing it after I wrote it.

## Alternative analytical way

Assuming that $$P$$ doesn't belong to line $$d$$, you are guaranteed that $$\|\vec{PX}\| > 0$$, and can define $$e_{\vec{PX}} := \frac{\vec{PX}}{\|\vec{PX}\|}$$ Now to see the dependency of $$e_{\vec{PX}}$$ on $$\vec V$$, just plug in your equation $$[1]$$: $$\vec{PX} = \vec{PA} + t\vec V$$ If you write down the expression of $$e_{\vec{PX}}$$ as a function of $$t$$ before differentiating (which is really annoying due to the norm in the denominator), you'll clearly end up with some $$\vec V$$ in $$\partial_te_{\vec{PX}}$$. Skipping through the computation steps, I personally end up with this expression: $$\partial_te_{\vec{PX}} = \frac{\vec V}{\|\vec{PX}\|} - e_{\vec{PX}}\left\langle e_{\vec{PX}},\ \frac{\vec V}{\|\vec{PX}\|}\right\rangle$$ In the particular case that $$X(t)$$ is the closest point on $$d$$ to $$P$$, this simplifies to $$\partial_te_{\vec{PX}} = \frac{\vec V}{\|\vec{PX}\|}$$ which is coherent with everything you did, and is a simple re-statement of your equation $$[3]$$.

## More geometric way

With your equation $$[1]$$, it's straightforward to see that the magnitude of $$\vec V$$ directly influences how "fast" point $$X(t)$$ moves along line $$d$$ (let's just say that $$t$$ represents time). This influence of $$\vec V$$ on speed is why the derivative of $$e_{\vec{PX}}$$ with respect to $$t$$ also depends on $$\vec V$$.

To illustrate this, I'll introduce some additional notations. Because we're in $$2D$$, for any unit vector $$e$$, you can find a real number $$\theta\in\mathbb R$$ such that $$e = \mathbf u(\theta) := \begin{pmatrix} \cos\theta\\ \sin\theta \end{pmatrix}$$ This of course applies to $$e_{\vec{PX}}$$, and to highlight the dependency on $$t$$ I'll keep it in the notation: $$e_{\vec{PX}} = \mathbf u(\theta(t))$$ Note that if $$e_{\vec{PX}}$$ varies continuously, you can force $$\theta(t)$$ to also be continuous. Assuming that everyone can be differentiated wrt $$t$$, you end up with: $$\partial_t e_{\vec{PX}} = \Big(\partial_t\theta(t)\Big)\times\mathbf u\left(\theta(t) + \frac\pi2\right)$$ This isn't important, but the term $$\mathbf u\left(\theta(t)+\frac\pi2\right)$$ is still a unit vector, and is specifically the rotation of $$\mathbf u(\theta(t))$$ by an angle of $$\frac\pi2$$ radians.

Next, $$\partial_t\theta(t)$$ is representative of how fast the vector $$e_{\vec{PX}}$$ rotates (around the fixed point $$P$$,) as $$X(t)$$ moves on line $$d$$, which depends both on the distance of $$P$$ from $$d$$, and the speed of $$X(t)$$ on $$d$$, which is precisely where $$\vec V$$ comes in.

If you still have trouble with this, picture the following situation: there's a straight road in front of you, on which every car drives at a constant speed. You decide to pick one of these cars at random, and to follow it with your eyes, while staying immobile. The speed at which you have to turn your overall gaze (with a combination of head and eye movements) depends on the speed of the car. That's especially obvious when the car is closest to you.

Following further thinking, I found the answer and I'm sharing it here below. In fact, the length of the shortest distance is hinted by the beginning of the section "2/" in the question. Basically, the condition $$\partial_t |\vec{PX}|=0$$ entirely determines the length and yields after some basic calculation steps: $$|\vec{PX}|=|\vec{PA}-\frac{\vec{PA}\,.\vec{V}}{\vec{V}\vec{V}}\vec{V}|$$. This is, indeed, the missing link with the reasoning above.

Then, under that condition, the object $$\partial_t |\vec{PX}|$$ vanishes in the equation $$[2]$$, which results in equation $$[3]$$ showing that, in such a case, the vector $$\vec{PX}$$ is perpendicular to $$\vec{V}$$, as explained in the body of the original question. What's more, we then get by substituting in equation $$[4]$$: $$\partial_t e_{\vec{PX}}=\frac{\vec{V}}{|\vec{PA}-\frac{\vec{PA}\,.\vec{V}}{\vec{V}\vec{V}}\vec{V}|} \,\,\,\, [5]$$ and this basically confirms the statement of @N.Bach that $$\partial_t e_{\vec{PX}}$$ is indeed a function of $$\vec{V}$$.

I ought to mention that even though I ended up answering my own question, I would never had the flash without @N.Bach's crucial contribution above of this dependence in $$\vec{V}$$, which was not obvious at first.