shortest distance from point to line using First Derivative Test

PaulKraemer

New member
Joined
Apr 10, 2011
Messages
45
Hi,

I am stuck on the following:

Use the First Derivative Test to prove that the shortest distance from a point (x1, y1) to the line ax + by + c = 0 is given by:
d = |ax1 + by1 + c| / sqrt (a^2 + b^2)

What I've done so far is:

(1) I figured the distance sqared between any point (x1, y1) and a point (x, y) on the line is given by:

d^2 = x^2 - 2xx1 + x1^2 + y^2 - 2yy1 + y1^2

(2) Rearranging ax + by + c = 0, I came up with:

y = (-a/b)x - c/b

(3) I substituted the forumula for y in (2) into the formula for d^2 in (1)

d^2 = x^2 - 2xx1 + x1^2 + (a^2/b^2)x^2 + 2acx/b^2 + c^2/b^2 + 2axy1/b + 2cy1/b + y1^2

(4) I took the derivative of the d^2 formula from (3) (assuming that minimizing d^2 is the same as minimizing d) (and treating x1, y1, a, b, and c as constants)

(d^2)' = 2x - 2x1 + (2a^2/b^2)x + 2ac/b^2 + 2ay1/b

(5) I set the formula for (d^2)' = 0 and solved for x. I got:

x = [(b^2)x1 - ac - aby1] / (b^2 + x^2)

(6) Now I have the formula for a critical number. To use the first derivative test to prove that this was a minimum, I would have to show that for values of x < this critical number, d^2 is negative and for values of x > this critical number, d^2 is positive. After determining that this critical number is a minimum, I would have to plug the formula for x that I got in (5) into the formula for d^2 that I got in (1), and then I would have to take the square root to get d.

Compared to the other problems in this chapter, this seems very complicated. I was wondering if anyone could tell me if I've gone wrong somewhere.

Thanks in advance,
Paul
 
I will use x1=p,   y1=q\displaystyle x_{1}=p, \;\ y_{1}=q to mitigate typing.

If b=0, the line is vertical and the minimum distance of (p,q) to the line is:

p+ca=ap+ca=ap+bq+ca2+b2\displaystyle \left|p+\frac{c}{a}\right|=\left|\frac{ap+c}{a}\right|=\frac{|ap+bq+c|}{\sqrt{a^{2}+b^{2}}}

If b0\displaystyle b\neq 0, the square of the distance between (x,   (ax+c)b)\displaystyle \left(x, \;\ \frac{-(ax+c)}{b}\right)

and (p,q) is \(\displaystyle D=(x-p)^{2}+\left(q+\frac{ax+c}{b}\right)^{2}}\)

The distance is minimum when:

D(x)=0\displaystyle D'(x)=0

2(xp)+2(q+ax+cb)(ab)=0\displaystyle 2(x-p)+2\left(q+\frac{ax+c}{b}\right)\left(\frac{a}{b}\right)=0

b2xb2p+abq+a2x+ac=0\displaystyle b^{2}x-b^{2}p+abq+a^{2}x+ac=0

x=b2pabqaca2+b2\displaystyle x=\frac{b^{2}p-abq-ac}{a^{2}+b^{2}}

The minimum distance between the point and the line is:

D(b2pabqaca2+b2)\displaystyle \sqrt{D\left(\frac{b^{2}p-abq-ac}{a^{2}+b^{2}}\right)}

=(b2pabqaca2+b2p)2+(q+abb2pabqaca2+b2+cb)2\displaystyle =\sqrt{\left(\frac{b^{2}p-abq-ac}{a^{2}+b^{2}}-p\right)^{2}+\left(q+\frac{a}{b}\cdot \frac{b^{2}p-abq-ac}{a^{2}+b^{2}}+\frac{c}{b}\right)^{2}}

=(a2pabqac)2+(ab2p+b3q+b2cb)2(a2+b2)2\displaystyle =\sqrt{\frac{(-a^{2}p-abq-ac)^{2}+\left(\frac{ab^{2}p+b^{3}q+b^{2}c}{b}\right)^{2}}{(a^{2}+b^{2})^{2}}}

=a2(ap+bq+c)2+b2(ap+bq+c)2(a2+b2)2\displaystyle =\sqrt{\frac{a^{2}(ap+bq+c)^{2}+b^{2}(ap+bq+c)^{2}}{(a^{2}+b^{2})^{2}}}

=ap+bq+ca2+b2\displaystyle =\frac{|ap+bq+c|}{\sqrt{a^{2}+b^{2}}}

The second derivative is D(x)=2(a2+b2)b2\displaystyle D''(x)=\frac{2(a^{2}+b^{2})}{b^{2}}. Which is always positive.
 
Thank you Galactus...

You are amazing. I guess I was heading in the right direction but I just didn't grind it out and plug my critical number for x into the distance formula because it looked so complicated I thought I was doing something wrong.

One quick question. You found the distance at the critical number for x. Then you used the second derivative test to determine that this distance is a minimum (because the second derivative is positive). I am able to follow this with no problem.

The only thing is, the problem asks me to use the First Derivative Test. If this is what I have to do, wouldn't I have to show that for the critical number...


35_fa5f7b0d13c0ec40323155d137eeb040.png


...that for x < this critical number, D' < 0 and for x > than this critical number, D' > 0?

With a relatively complex formula for the critical number and a relatively complex first derivative, I have no clue how I would show this. I think the Second Derivative Test the way you did it is easy to understand, but if I had to do it with the First Derivative Test, if you could give me a clue how to go about this, I'd really appreciate it.

If you tell me that it just doesn't make sense to use the First Derivative Test in this case it is fine. I'm not doing this for a grade - I'm really just curious. I am just reviewing calculus for the heck of it after being out of school for 20 years.

Thanks again for all your help,
Paul
 
We pretty much used the first derivative test to find the minimum. I think that is all is meant by the problem. Just by setting D(x)=0\displaystyle D'(x)=0 and getting the x value that gives the minimum.

The first derivative test says that the slope is negative to the left and positive to the right of the critical point when we have a minimum. What we done here should suffice.

Notice the derivative is linear. Thus, the derivative is going to remain constant. So, what has been shown is hunky-dory.:)

The slope is m=2(a2+b2)b2\displaystyle m=\frac{2(a^{2}+b^{2})}{b^{2}}. This is positive all the time. So, it is done.

Yes, I know this is the second derivative as well.

That's because the first derivative is a line. When we take the derivative of a line all we're left with is the slope.

Say we have y=mx+b. The derivative is m.

In this case, the distance formula is a quadratic. The first derivative is linear. Since the first derivative is linear, the slope stays the same throughout.

If we take the derivative of a quadratic, ax2+bx+c\displaystyle ax^{2}+bx+c, we get a linear function, 2ax+b\displaystyle 2ax+b

The second derivative is then 2a\displaystyle 2a.

Same deal here. We really do not need the second derivative test because we get what we need from the first.

See what I am trying to get at?.
 
Last edited:
Hi Galactus,

I think I see what you are saying...the derivative is linear and its slope is constant and positive. Because we have shown that the derivative = 0 at our critical number, the derivative has to be < 0 to the left of this critical number and > 0 to the right of this critical number. Thus, by the first derivative test, our critical number is a minimum.

Being you get the slope by taking the second derivative, it is kind of blurry as to whether you are using the first derivative test or the second derivative test, but I suppose you can get the slope without actually taking the second derivative if you rearrange the D'(x) formula in y = mx + b form.

D'(x) = [(2)(a^2 + b^2)/(b^2)]x - 2p + 2aq/b + 2ac/b^2

I am not sure if I am writing this perfectly, but I do think I understand. Thanks again for your help!!

Thanks,
Paul
 
The "possible" minimum value of d2 is = 0. d2 cannot ever be negative (since d is real - distance). Thus if you have a quadratic equation for d2 - as a function of 'x' - the minimum value is at d(d2)/dx = 0 and/or d = 0

In your case if d= 0, then the point is lying on the line in question.

Another way to look at it:

d2 = x^2 - 2xx1 + x1^2 + (a^2/b^2)x^2 + 2acx/b^2 + c^2/b^2 + 2axy1/b + 2cy1/b + y1^2

= (1 + a^2/b^2) * x^2 + (- 2x1 + 2ac/b^2+ 2ay1/b)* x + (x1^2+ c^2/b^2+ 2cy1/b + y1^2)

Notice that the equation of d2 is that of a parabola and the coefficient of x2 is positive - hence it is a parabola "opening up" - with only one local minimum.

No explicit test needed.
 
Last edited by a moderator:
Top