Question: Find the distance from the point $B = (1, 1, 1)$ and the line l through the point $A = (-1, 1, 2)$ and the direction vector $d = [1, 0, 1]$.

Here is what I've found: Vector Form of line l (maybe?): $[-1, 1, 2] + t[1, 0, 1] = [-1+t, 1, 2+t] =$ I call it the vector $x$ And the parametric equations: $x = -1 + t$

$y = 1$

$z = 2 + t$

I think what I need to do is find the projection of vector b onto vector x which would be:

$(x•b)/(x•x) * x$ ...or its also equal to: $(x•b)/(|x|^2) * x$

So if all of my thinking is correct, my only problem is I don't know how to do a projection in $R^3$. Especially not with a vector in the parametric form which is all I can seem to get it in. Is there any advice, or a reference you can point me towards - I haven't been able to find any so far ...

  • $\begingroup$ How would you do a projection onto a line in two dimensions? $\endgroup$
    – amd
    Feb 1, 2018 at 1:08
  • $\begingroup$ A point and a line define a plane, so the problem is 2 dimensional. $\endgroup$ Feb 1, 2018 at 1:25
  • $\begingroup$ I do not understand, the vectors have 3 components doesn't that make it 3 dimensional? $\endgroup$
    – Kyle Hobbs
    Feb 1, 2018 at 1:31

2 Answers 2



To simplify matters, let's minimize $D^2=2t^2-2t+5$...

$D'(t)=4t-2=0\implies t=\frac12$.

Now evaluate $D$ at $\frac12$: $$D(\frac 12)=\sqrt{2\frac14-1+5}=\sqrt{\frac92}=\pm\frac3{\sqrt2}$$.


How about minimizing the distance from $l$ to $B$? If you know any calculus, you know this can be done by setting the derivative of the distance function (a function of $t$), equal to zero...

As for projection, you seem to have the right formula. When you cover Graham-Schmidt you will get good at this...

So, $(B-A)\cdot d=(2,0,-1)\cdot(1,0,1)=1$. Divide by $\lvert d\rvert =\sqrt2$. Now by the Pythagorean theorem, we have ${\lvert B-A\rvert} ^2=(\frac1{\sqrt2})^2+D^2$. So $5=\frac12+D^2$. So $D=\frac3{\sqrt2}$...


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.