In the case where the line is in 2D and its equation has the general form $ax +by =c$, the distance $d(B, l)$ from $B = (x_0, y_0)$ is given by the formula:

$$d(B, l) = \frac{|ax_0+by_0-c|}{\sqrt[]{a^2 + b^2}}$$

How do I go about proving this? I figured that $B$ could be expressed in terms of the normal vector as $B = f[a, b, c]$, where $f$ is a scalar coefficient but I am not sure whether that leads anywhere. Thanks for any guidance.

  • $\begingroup$ do you want a proof w/out vector? $\endgroup$ – Mythomorphic Jun 10 '15 at 7:03
  • $\begingroup$ Yes of course, that was just that I came up with. $\endgroup$ – pseudomarvin Jun 10 '15 at 7:09
  • $\begingroup$ I will type it out. $\endgroup$ – Mythomorphic Jun 10 '15 at 7:09

Let $B'(x_1,y_1)$ where $BB'$ is perpendicular to $L:ax_0+by_0+c$.

As $B'$ lay on $L$, $B'= (x_1,-\frac{a}bx_1+\frac{c}b)$ .

As $BB'$ is perpendicular to $L$, product of slope of $L$ and $BB'=-1$. So we have:

$$\frac{-\frac{a}bx_1+\frac{c}b-y_0}{x_1-x_0}=-\frac{b}a$$ $$-\frac{a^2}{b^2}x_1+\frac{ac}{b^2}-\frac{a}by_0=x_1-x_0$$ $$(1+\frac{a^2}{b^2})x_1=x_0-\frac{a}by_0+\frac{ac}{b^2}$$ $$x_1=\frac{b^2x_0-aby_0+ac}{a^2+b^2}$$ $$y_1=\frac{-abx_0+a^2y_0-\frac{ac}{b^2}+\frac{ac}{b^2}+bc}{a^2+b^2}=\frac{-abx_0+a^2y_0+bc}{a^2+b^2}$$


\begin{align} D(B,L)&=\sqrt{(\frac{b^2x_0-aby_0+ac}{a^2+b^2}-x_0)^2+(\frac{-abx_0+a^2y_0+bc}{a^2+b^2}-y_0)^2}\\&=\sqrt{(\frac{-a^2x_0-aby_0+ac}{a^2+b^2})^2+(\frac{-abx_0-b^2y_0+bc}{a^2+b^2})^2}\\&=\sqrt{1+\frac{b^2}{a^2}}\cdot|\frac{-a^2x_0-aby_0+ac}{a^2+b^2}|\\&=\sqrt{\frac{a^2+b^2}{a^2}}\cdot|\frac{-a^2x_0-aby_0+ac}{a^2+b^2}|\\&=\frac{\sqrt{a^2+b^2}}{a}\cdot|\frac{a^2x_0+aby_0-ac}{a^2+b^2}|\\&=|\frac{ax_0+by_0-c}{\sqrt{a^2+b^2}}| \end{align}

  • $\begingroup$ Thanks for your time, that was a very thorough answer and I've learned a lot just by working through it. Could I ask you what exactly happens in the last step of the proof? It seems like the nominator is divided by $(-a)$ and you take the square root of the denominator but I am not sure why it happens. $\endgroup$ – pseudomarvin Jun 10 '15 at 11:23
  • 1
    $\begingroup$ I've added the second last step.Is it clear now? $\endgroup$ – Mythomorphic Jun 10 '15 at 11:31
  • $\begingroup$ Yes, I get it now. Thanks again for your help. $\endgroup$ – pseudomarvin Jun 10 '15 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.