Distance Between A Point And A Line

Any Hint on proving that the distance between the point $(x_{1},y_{1})$ and the line $Ax + By + C = 0$ is,

$$\text{Distance} = \frac{\left | Ax_{1} + By_{1} + C\right |}{\sqrt{A^2 + B^2} }$$

What do I use to get started? All I know is the distance formula $\sqrt{(x_{2}-x_{1})^2+(y_{2}-y_{1})^2}$.

Kindly Help


Solution 1:

Here is an elementary geometric derivation of the formula:

Any (st.)line perpendicular to the line $$Ax+By+C=0\qquad\text{(1)}$$ is given by $$Bx-Ay+C'=0\qquad\text{(2)}$$ Since (2) has to pass through the point $(x_1,y_1)$ (WHY?), we have $C'=Ay_1-Bx_1$. So, (2) becomes $$Bx-Ay+Ay_1-Bx_1=0\Rightarrow \frac{x-x_1}{A}=\frac{y-y_1}{B}=t\text{ (say)}\qquad(3)$$ From (3), $x=At+x_1$ and $y=Bt+y_1$. This is (called) the parametric equation of the line (2). Each $t$ correspond a point in it and vice-verse. Our next task is to determine the value of $t$ such that (1) and (2) meet at that point. To do so, substituting the value of $x$ and $y$ in (1), we get $t=-\frac{Ax_1+By_1+C}{A^2+B^2}$. Hence the required distance is $$\sqrt{(x-x_1)^2+(y-y_1)^2}=\sqrt{A^2t^2+B^2t^2}=|t|\sqrt{A^2+B^2}=\frac{|Ax_1+By_1+C|}{\sqrt{A^2+B^2}}.$$

Solution 2:

For what it's worth, here's the outline using the "derivative approach". Since you tagged this as analytic geometry, I would think the splendid answers by Americo and Didier would be the better approach.

Rewriting your equation of the line for $B\ne0$ gives: $$ y={-Ax-C\over B}. $$ (If $B=0$, the line is vertical, and the problem is simple.)

If the point $(x, {-Ax-C\over B})$ is on the line, its distance to $(x_1,y_1)$ is $$ \tag{1}D=\sqrt{ (x_1-x)^2 + {\Bigl(y_1- { \textstyle{-Ax-C\over B}}\Bigr)^2 }}. $$

You want to find the smallest value of $D$. This is equivalent to finding the smallest value of $$ P(x)=D^2= (x_1-x)^2 + {\Bigl(y_1- { \textstyle{-Ax-C\over B}}\Bigr)^2 } $$

Now, it should be obvious that the distance from a point $p$ on the line to $(x_1,y_1)$ is big, if $p$ is "on an extreme end of the line". So, the minimum distance is attained at a point where $P'(x)=0$.

So, you need to find $P'(x)$, then solve $P'(x)=0$. I'll leave this for you...

You should only get one solution to $P'(x)=0$. The minimum of $P$, and hence the minimum of $D$, would then have to occur at this point . If you then plug this solution into (1), your formula will result after a bit of simplification.

Solution 3:

The distance $d$ between the point $P_1(x_{1},y_{1})$ and the line $r$ whose equation is $Ax+By+C=0$ can be derived algebraically as follows:

i) Find the equation of the straight line $s$ passing through $P_1$ and which is orthogonal to $r$. Call $P_2$ the intersecting point of $r$ and $s$.

ii) Find the co-ordinates of $P_2(x_{2},y_{2})$.

iii) Find the distance from $P_1$ to $P_2$. This distance is $d$.

Solution 4:

Assume $(x_0,y_0)$ is on the line and $(x_1-x_0,y_1-y_0)$ is orthogonal to the line. Pythagore says the square of the distance from $(x_1,y_1)$ to any $(x,y)$ on the line is the sum of the squares of the distances from $(x_1,y_1)$ to $(x_0,y_0)$ and from $(x_0,y_0)$ to $(x,y)$. Hence this distance is minimal when $(x,y)=(x_0,y_0)$.

What is $(x_0,y_0)$? First, $(x_0,y_0)$ is on the line hence $Ax_0+By_0+C=0$. Second, the vector $(x_1-x_0,y_1-y_0)$ is orthogonal to the line hence it is proportional to $(A,B)$.

Thus $x_0=x_1-Az$ and $y_0=y_1-Bz$ for some $z$. Plugging this into the first condition yields $A(x_1-Az)+B(y_1-Bz)+C=0$, that is, $(A^2+B^2)z=Ax_1+By_1+C$.

Finally, the distance $D$ from $(x_0,y_0)$ to the line is simply the Euclidean norm of the vector $(Az,Bz)$, hence $D^2=(A^2+B^2)z^2$, and I will let you finish from here.