# How to find a point on a line closest to a specified point using calculus?

I have a line function that is $y = x + 4$ and I want to find the point on that line that is closest to the point $(1,1)$.

Here is my attempt. $y = x + 4$ so that means $(x, x + 4)$ should be my initial point and $(1,1)$ will be my final point.

I assume I'll need to make use of the distance formula so $\sqrt[2]{(1-x)^2 + (-x-3)^2}$

This is where I'm stuck. I think I need to take the derivative of it, but when I do, I come out with $\frac{1}{2}(4x + 10)^\frac{-1}{2}$ which doesn't seem right especially if I want to set it to $0$.

-
You know this can be solved relatively easily with analytic geometry, correct? – Mike Nov 28 '12 at 21:13
@Mike I assumed it could be; however, this is practice for an exam I have in calculus. I don't think the teacher would give credit if I used geometry to solve it on the test. – StrugglingWithMath Nov 28 '12 at 21:17

Hint: Minimizing the distance is equivalent to minimizing the square of the distance. Remove that square root sign. You get a harmless quadratic.

So I would write "equivalently, we minimize the square of the distance $\dots$. "

The calculation can be done without removing the square root sign, but the probability of mechanical error increases markedly.

-
So my derivative would then be 4x - 4 which would make my x = 1 and my y = 5? – StrugglingWithMath Nov 28 '12 at 20:47
@StrugglingWithMath: My calculatation gives derivative $4x+4$. – André Nicolas Nov 28 '12 at 20:55
Again stupid simple mistake on my end :( you are right. Changing the values to $x = -1$ and $y = 3$ ? I need to be careful and watch what I do with these problems; the negative sign got me twice in a row! – StrugglingWithMath Nov 28 '12 at 20:56
@StrugglingWithMath: Yes, correct. By the way, when you were finding the square of the distance between $(1,1)$ and $(x,x+4)$, your expression was right, but made me shudder a bit, so many minus signs! I would have done the subtraction the other way, getting $(x-1)^2+(x+3)^2$. Same thing as yours, but in my opinion nicer, it's harder to make a mistake later. – André Nicolas Nov 28 '12 at 21:01
On my paper I do that part in two steps. First step is the one I have in my post and second step is like the one you just posted (making x first and dividing out the negatives). I'll keep in mind for my next post to just post my second step instead. Thanks for the help! – StrugglingWithMath Nov 28 '12 at 21:07

If you expand under the square root, you should get $2x^2+4x+10$. It looks like you canceled the $x^2$ terms, but they are both positive. Then you need the derivative of this in the numerator from the chain rule.

-
You are correct. I incorrectly made one of my $x^2$ negative. Which would make the derivative: $4x + 4$. Set that equal to 0 making $x = -1$ and $y = 3$ correct? – StrugglingWithMath Nov 28 '12 at 20:57
@StrugglingWithMath: That is right. The denominator of the derivative doesn't matter when you set the derivative to zero, and the numerator is $4x+4$. A check is that the the line from your point to $(1,1)$ should be perpendicular to the given $y=x+4$, which it is. – Ross Millikan Nov 28 '12 at 21:38