Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Given the line $x+2=\frac{y+4}{2}=\frac{z-5}{-2}$
I want to find the closest point on this line to $(1,1,1)$

I suppose the details here don't matter but in general how is this done? We need a vector perpendicular to the line but that also reaches $(1,1,1)$.

share|cite|improve this question
A line and a point not on that line determine a plane, so you need to find the line perpendicular to your line on that plane. – Harry Stern Dec 5 '10 at 23:47
So I can pick any other line that does not intersect with the above line? – fdart17 Dec 5 '10 at 23:52
up vote 9 down vote accepted

One point on the line is $(-2, -4, 5)$ and another is $(0,0,1)$ (found by setting the equation to 0, then to 2). So the general point is $(-2t, -4t, 1+4t)$. You want the dot product of the vector from a point on the line to $(1, 1, 1)$ and a vector along the line to be zero. So $$(-2, -4, 4)\cdot(-2t-1, -4t-1, 4t)=0$$ $$4t+2+16t+4+16t=0$$ $$t=\frac{-1}{6}$$ And the point is $$\left(\frac{1}{3},\frac{2}{3},\frac{1}{3}\right)$$

share|cite|improve this answer

One method is to parametrize the line. So $$\vec{r}(t) = (t-2)\hat{\imath} + (2t-4)\hat{\jmath} + (-2t+5)\hat{k}$$ We can then define the real-valued function $d(t)$ representing the distance from the line to $(1,1,1)$ for any value of $t$. Hence $$d(t) = \sqrt{(t-3)^2 + (2t-5)^2 + (-2t+4)^2} = \sqrt{9t^2 - 42t + 40}$$ To find the minimum, it's now only a single variable optimization problem. So by standard procedure, look at $d'(t)$ $$d'(t) = \frac{9t - 21}{\sqrt{9t^2 - 42t + 40}}$$ The critical point occurs at $t = \frac{7}{3}$, so the closest point is $\vec{r}(\frac{7}{3}) = (\frac{1}{3},\frac{2}{3},\frac{1}{3})$.

share|cite|improve this answer

Using multi-variable calculus you would write a formula for distance from the point (1,1,1) to the arbitrary point (x,y,z) (this second points needs to satisfy your equation since it lies on the line). You would then apply the multi-variable optimization procedure: Find the critical points of this functions (those points where both partial derivatives equal zero or those points where either partial derivative is undefined) and examine these to find the minimum value for distance.

If you do want to use linear algebra, a vector from the point (x,y,z) (on the line) to the point (1,1,1) is $<1-x,1-y,1-z>$ Now take a directional vector from your line and compute the dot product of this with $<1-x,1-y,1-z>$. As you said, this dot product should be zero so solve for x,y, and z.

share|cite|improve this answer
I don't know multi-variable calculus yet! But thanks. I was in fact thinking about optimizing but then I would have to relate this to projections and this would get super messy and probably incalculable. – fdart17 Dec 5 '10 at 23:49

First express $y$ and $z$ in terms of $x$: $y=y(x)$, $z=z(x)$. You want to find the minimum of $f(x) = (x-1)^2 + (y(x)-1)^2 + (z(x)-1)^2$. Noting that $f(x)$ is a parabola, you should find easily the (single) $x$ that minimizes $f(x)$ (global minimum). Then, you get $y(x)$ and $z(x)$ by substitution.

EDIT: Explicitly, $y(x)=2x$ and $z(x)=1-2x$. This leads to $f(x)=9x^2-6x+2$, whose minimum is obtained at $x=1/3$. The solution is then $(x,y,z)=(1/3,2/3,1/3)$, as already given in two previous answers.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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