Proof of Formula for Distance Between Line and Point in 2D

Find the least distance of the line  
  from the point  

Rearrange the line as  
\[y=- \frac{a}{b}x+ \frac{c}{b}\]
The gradient of this line is  
\[- \frac{a}{b}\]
The gradient of the perpendicular line is  
The perpendicular line passes through the point  
\[y_0=\frac{b}{a}x_0+c \rightarrow c=y_0- \frac{b}{a}x_0\]

The equation of the perpendicular line is  
\[y=\frac{b}{a}x+y_0- \frac{b}{a}x_0\]
  Now find the point of intersection of these two lines by solving the simultaneous equations  
\[ax+by=c, \; y=\frac{b}{a}x+y_0- \frac{b}{a}x_0\]
, equivalent to
  times (1) to  
  times (2) to give
\[a^2x+b^2x=ac-aby_0-a^2x_0 \rightarrow x= \frac{ac-aby_0-a^2x_0}{a^2+b^2}\]
  times (2) from  
  times (1) to give
\[a^2y+b^2y= bc-abx_0+a^2y_0 \rightarrow y= \frac{bc-abx_0+a^2y_0}{a^2+b^2}\]
The distance  
  is then the distance between the points  
\[(\frac{ac-aby_0-a^2x}{a^2+b^2}, \frac{bc-abx_0+a^2y_0}{a^2+b^2})\]

\[\begin{equation} \begin{aligned} d &=\sqrt{(\frac{ac-aby_0+b^2x_0}{a^2+b^2}-x_0)^2+(\frac{bc-abx_0+a^2y_0}{a^2+b^2}-y_0)^2} \\ &=\sqrt{(\frac{ac-aby_0-a^2x_0}{a^2+b^2})^2+(\frac{bc-abx_0-b^2y_0}{a^2+b^2})^2} \\ &= \sqrt{\frac{(a^2+b^2)(c-by_0-ax_0)^2}{a^2+b^2)^2}} \\ &= \frac{c-ax_0-by_0}{\sqrt{a^2+b^2}}\end{aligned} \end{equation}\]

Add comment

Security code