Say the equation of a line is given by the parametric equations $x=x(t), y=y(t), z=z(t)$, then $$r(t)=x(t)\vec{i}+y(t)\vec{j}+z(t)\vec{k}$$ can be reduced to $$r(t)=r_0+t \begin{bmatrix} a \\ b \\ c\end{bmatrix}$$ where $r_0$ is the initial point the line passes through and the vector with components $a,b,c$ is direction vector of $r$. Now I want to find the shortest distance $d$ from the line to the point $P_1(x_1, y_1, z_1)$ outside of this line. I'm able to find the direction vector of $d$, which I think is $\begin{bmatrix} x_1-x_0 \\ y_1-y_0 \\ z_1-z_0 \end{bmatrix}$ but I'm not able to take it any further to find $\Vert d\Vert$.

  • $\begingroup$ What you have found is not direction vector of $d$ but direction vector from $P$ to the given point on the line. Now, do a cross product with the normalized direction vector of the line. The magnitude gives you the shortest distance. $\endgroup$
    – Math Lover
    Oct 5 at 0:26
  • $\begingroup$ Or you can take any arbitrary point on the line $(x_0 + at, y_0 + b t, z_0 + ct)$ and find vector from $P$ to this arbitrary point. Now if it is shortest distance to the line, the vector would be perp to the line so the dot product of the vector with the direction vector of the line will be zero. Once you solve for $t$, you get the point on the line which has shortest distance from $P$. You can then find distance using formula for distance between two points. $\endgroup$
    – Math Lover
    Oct 5 at 0:30

The distance from the point $(x_1, y_1, z_1)$ to an arbitrary point of the line satisfies $$ D^2 = (x_1-x(t))^2 + (y_1-y(t))^2 + (z_1-z(t))^2$$

You want to minimize this function.

Take the derivative with respect to $t$ and let the derivative equal zero to find the $t$ which gives you the shortest distance.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.