Let l be a line described by equation ax+by+c=0 and let P(x,y) be a point not on l. Express the distance, d between l and P in terms of the coefficients a, b and c of the equation of line?

enter image source here

1 Answer
Nov 14, 2016

d = (c + a x_0 + b y_0)/sqrt(a^2 + b^2)

Explanation:

Let l->a x + b y + c=0 and p_0 = (x_0,y_0) a point not on l.

Supposing that b ne 0 and calling d^2=(x-x_0)^2+(y-y_0)^2 after substituting y=-(a x+c)/b into d^2 we have

d^2=(x - x_0)^2 + ((c + a x)/b + y_0)^2. The next step is find the d^2 minimum regarding x so we will find x such that

d/(dx)(d^2) = 2 (x - x_0) - (2 a ((c + a x)/b + y_0))/b = 0. This occours for

x = (b^2 x_0 - a b y_0-a c)/(a^2 + b^2) Now, substituting this value into d^2 we obtain

d^2=(c + a x_0 + b y_0)^2/(a^2 + b^2) so

d = (c + a x_0 + b y_0)/sqrt(a^2 + b^2)