10
$\begingroup$

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

$\endgroup$
4
  • 3
    $\begingroup$ Try to find the global minima of your distance formula when plugging in the line for $x_2,y_2$ $\endgroup$
    – Listing
    Nov 26, 2011 at 12:43
  • $\begingroup$ I have no idea how to find the global minima. $\endgroup$
    – alok
    Nov 26, 2011 at 12:55
  • 1
    $\begingroup$ A geometric way of looking at it: your problem is equivalent to finding the radius of a circle that is tangent to a given line and centered at a given point. Remember that tangency of a circle and a line corresponds to the resulting quadratic equation having a double root. $\endgroup$ Nov 26, 2011 at 13:49
  • $\begingroup$ @J.M. Assuming the OP knows the tangency condition (or in the worst case to get tangent replace $x^2$ by $xx'$ etc), this is the best way, IMHO. $\endgroup$
    – Tapu
    Nov 26, 2011 at 14:05

9 Answers 9

12
$\begingroup$

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}}.$$

$\endgroup$
6
$\begingroup$

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.

$\endgroup$
3
  • $\begingroup$ Just doing it to buy time!!I see there are many methods to prove this.The elementary geometric derivation was the easiest for me,However I have considered all the solutions to be very usefull.Thanks to all of you. $\endgroup$
    – alok
    Nov 26, 2011 at 13:46
  • $\begingroup$ I thought I'd give this a go. I found $P'(x)$ and solved $P'(x) = 0$. Plugging that into (1) was where I had to give up though. I started to work through the formula and things got too complicated for me. Perhaps I'm missing a trick on how to simplify this expression by hand effectively. $\endgroup$
    – PeteUK
    May 9, 2013 at 10:18
  • $\begingroup$ Following up from my last comment, I asked a separate question about doing the algebraic simplification and got a good response. $\endgroup$
    – PeteUK
    May 12, 2013 at 15:47
6
$\begingroup$

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$.

$\endgroup$
4
  • $\begingroup$ orthogonal means perpendicular right? If that's the case i know that $m_{1}m_{2} = -1$ or $m_{1} = \frac{-1}{m_{2}}$ where m is the slope.Still strugling to get started. $\endgroup$
    – alok
    Nov 26, 2011 at 13:35
  • $\begingroup$ It looks I have done all the exercises you prescribed for the OP :) $\endgroup$
    – Tapu
    Nov 26, 2011 at 14:10
  • $\begingroup$ @alok Yes. Let $A'x+B'y+C'=0$ be the equation of $s$. Compute the slopes $m=-A/B$ and $m'=-A'/B'$. Let $\theta$ be the angle between $r$ and $s$. From the condition $\tan \theta=0$, and since $P_1$ is a point of $s$ one can show that the equation of $s$ is $B(x-x_1)-A(y-y_1)=0$. $\endgroup$ Nov 26, 2011 at 14:21
  • $\begingroup$ @Swapan: That's right. In my comment to OP I try to indicate how your equation $(2)$ may be derived using trigonometry. $\endgroup$ Nov 26, 2011 at 14:29
3
$\begingroup$

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.

$\endgroup$
2
$\begingroup$

enter image description here

Consider the line $\overleftrightarrow{l}$ whose equation is $Ax+By+C=0$, and the point $P(x_1,y_1)$ as shown above. Suppose $\overleftrightarrow{l}$ intersects the $x$ and $y$ axis at points $M$ and $N$ respectively.

To find the distance between $P$ and $\overleftrightarrow{l}$, let’s first find the distance between the $x$ and y-intercepts of $\overleftrightarrow{l}$.

So, the length $MN$ is given as $\left| \dfrac{C}{AB}\right| \sqrt{A^{2}+B^{2}}$

enter image description here

We found the length of $MN$ as $\left| \dfrac{C}{AB}\right| \sqrt{A^{2}+B^{2}}$ units. Now, suppose $PQ$ is the perpendicular drawn from $P$ to $\overleftrightarrow{l}$ as shown above.

We know that area of a triangle is given as $$Area =\dfrac{1}{2}× Base × Height$$

So, using this result, we can write: $$Area \triangle{PMN}=12×MN×PQ$$

$$\Rightarrow Area \triangle{PMN}=\dfrac{1}{2}× \left| \dfrac{C}{AB}\right| \sqrt{A^{2}+B^{2}} ×PQ$$ $$\Rightarrow PQ=2\times\left| \dfrac{AB}{C}\right| \dfrac{1}{\sqrt{A^2+B^2}} \times Area \triangle{PMN}$$

We found the distance $PQ$ as $$PQ=\left| \dfrac{2AB}{C\sqrt{A^{2}+B^{2}}}\right| Area △PMN$$

Now Consider the above △PMN again; We know that the area of a triangle having vertices at $(x_1,y_1),(x_2,y_2)$ and $(x_3,y_3)$ is given as

$$Area = \frac{1}{2}\left|x_{1}\left(y_{2}-y_{3}\right)+x_{2}\left(y_{3}-y_{1}\right)+x_{3}\left(y_{1}-y_{2}\right)\right|$$

So, using the above result, Area $\triangle{PMN}$ becomes $\dfrac{1}{2}\left| \dfrac{C}{AB}\right| \cdot \left| Ax_1 +By_1 + C\right|$ sq. units.

We found the following:

  • $P Q=\left|\frac{2 A B}{C \sqrt{A^{2}+B^{2}}}\right|$ Area $\triangle P M N \quad \ldots(\mathrm{i})$
  • Area $\triangle P M N=\frac{1}{2}\left|\frac{C}{A B}\right| \cdot\left|A x_{1}+B y_{1}+C\right| s q .$ units $\cdots (2)$

From (i) and (ii), we'll get: $$ P Q=\frac{\left|A x_{1}+B y_{1}+C\right|}{\sqrt{A^{2}+B^{2}}} $$

Therefore, the perpendicular $distance (d)$ between the point $P(x_1,y_1)$ and the line $Ax+By+C=0$ is given as $d=\dfrac{\left | Ax_{1} + By_{1} + C\right |}{\sqrt{A^2 + B^2} }$

$\endgroup$
1
$\begingroup$

I am not solving but i'm giving steps for it. 1.draw a perpendicular on giving line from given point. 2.since we've line equation so we can find out its slope(m). 3.use the relation to find out slope of perpendicular line m1*m2=-1 (m1 and m2 are slopes of perpendicular lines).now we have slope of perpendicular line and 1 point from which it is passing by(given point(x1,y1)). 4.find out equation of perpend.line. 5.find out intersection point of bot line. 6.finally calculate distance between given point and intersection point.

$\endgroup$
1
$\begingroup$

(I have edited the answer, as Bob Dobbs pointed out, Case $B=0$ need to be considered separately.)

Here is a derivation using vectors.

Let $P$ be the point $(x_1, y_1)$.

The line with equation $Ax + By + C = 0$ has normal vector

$$ \boldsymbol{N} = \begin{bmatrix} A \\ B \end{bmatrix}.$$

Note that this is just the coefficients of the equation in order.

Let's pick some point on the line. If $B \neq 0$, then when $x=0$, $y=-C/B$. Let this point on the line, $(0, -C/B)$ be $Q$.

Consider the vector $$\overrightarrow{QP}= \begin{bmatrix} x_1 \\ y_1 + C/B \end{bmatrix}.$$The distance from point $P$ to line $Ax + By + C = 0$ is the length of the vector projection of $\overrightarrow{QP}$ on $\boldsymbol{N}$. This vector projection has length $$\left |\frac{\boldsymbol{N}}{||\boldsymbol{N}||} \cdot \overrightarrow{QP}\right | = \left|\frac{Ax_1 + By_1 + C}{\sqrt{A^2+B^2}}\right|.$$

If $B=0$, then the equation of the line becomes $x = -\frac{C}{A}$. The distance between $P$ and the line is $$\left|x_1 -\frac{C}{A}\right|.$$

Note that the formula is still true. If $B=0$ then $$\left|\frac{Ax_1 + By_1 + C}{\sqrt{A^2+B^2}}\right| = \left|x_1 -\frac{C}{A}\right|.$$

$\endgroup$
0
$\begingroup$

Nothing to see here, just me preparing for my Calc 3 final by attempting this.

We can Lagrange this. Let $f(x) = \sqrt{(x - x_1)^2 + (y - y_1)^2}$ be the distance of $(x_1, y_1)$ from some $(x, y)$ on the line $Ax + By + C = 0$. Also, let $g(x) = Ax + By + C = 0$ be our constraint function, and $(f(x, y))^2 = (x - x_1)^2 + (y - y_1)^2$ be our target function. We want to minimize the distance of the point to the line, basically.

Observe that $\nabla (f(x, y))^2 = \langle 2(x - x_1),2(y - y_1) \rangle$, and $\nabla g(x, y) = \langle A, B \rangle$. Because of the way the gradient behaves around critical points, $\nabla (f(x, y))^2 = \nabla g(x, y)$, so $\langle 2(x - x_1),2(y - y_1) \rangle = \lambda \langle A, B \rangle$. The solutions to this equation are $x = x_1 + \dfrac{\lambda A}{2}$ and $y = y_1 + \dfrac{\lambda B}{2}$ (this is nice because then $x - x_1 = \dfrac{\lambda}{2}A$ and $y - y_1 = \dfrac{\lambda}{2}B$, both of which are helpful later). Plug this back into $Ax + By + C = 0$, and you obtain $\lambda = \dfrac{2Ax_1 + 2By_1 + 2C}{A^2 + B^2}$.

The distance $f(x) = \sqrt{(x - x_1)^2 + (y - y_1)^2} = \sqrt{\left(\dfrac{\lambda A}{2}\right)^2 + \left(\dfrac{\lambda B}{2}\right)^2} = \dfrac{|\lambda|}{2} \sqrt{A^2 + B^2}$. Putting in the expression for $\lambda$, the closest distance is $$\min f(x) = \dfrac{1}{2}\left|\dfrac{2Ax_1 + 2By_1 + 2C}{A^2 + B^2}\right|\sqrt{A^2 + B^2} = \dfrac{|Ax_1 + By_1 + C|}{\sqrt{A^2 + B^2}},$$as desired.

$\endgroup$
0
$\begingroup$

I like s114's idea and answer but what if $B=0$?

My try: A normal vector of the given line $l$ is $\vec n=\langle A,B\rangle$. Let $X(x,y)$ be the the foot of the perpendicular from $P(x_1,y_1)$ to $l$. Then $\langle x-x_1, y-y_1\rangle=k\langle A,B\rangle$ for some $k\in\Bbb R$. Hence, we have $x=kA+x_1$ and $y=kB+y_1$. On the other since $Ax+By+C=0$ and we get $k=-\frac{Ax_1+By_1+C}{A^2+B^2}$. Finally, the distance of $P$ to the given line is $d=\sqrt{(x-x_1)^2+(y-y_1)^2}=|k|\sqrt{A^2+B^2}=\frac{|Ax_1+By_1+C|}{\sqrt{A^2+B^2}}.$

$\endgroup$

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .