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