Thread: distance of line and a point

1. distance of line and a point

if $l:ax+by+c=0$ is a line in the 2-space and $P_0(x_0,y_0)$ is a point, then the distance between the point $P_0$ and the line $l$ is:

$\frac{|ax_0+by_0+c|}{\sqrt{a^2+b^2}}$

Can anyone explain briefly to me why is that so? Does it based on the concept of orthogonal projection?

2. Let $d$ be the line passing through $P_0$ and perpendicular to line $l$.

The slope of line $l$ is: $m_l=-\frac{a}{b}$

Then the slope of line $d$ is $m_d=\frac{b}{a}$.

The equation of line $d$ is $y-y_0=\frac{b}{a}(x-x_0)$

The intersection point of the two lines is $P_1\left(\frac{b^2x_0-aby_0-ac}{a^2+b^2},\frac{a^2y_0-abx_0-bc}{a^2+b^2}\right)$.

Then the distance between the point P0 and the line l is the distance between the points P0 and P1. Use the formula of distance between two points and you'll get the result you want to prove.

3. The shortest distance from a point to the line is perpendicular to the line (which I guess you could show with calculus if you didn't believe). And any perpendicular to the line $ax+by+c=0$ will have the form $-bx+ay+d=0$.
Clearly to pass through (x0,y0) you need d to take the value $bx_0-ay_0$. Then you can find where the perpendicular meets the line and so calculate the distance. You could do this in a general way, and it will turn out you get the answer that you do. I'm not sure there is any special reason why it turns out so elegantly (and it is even more elegant if you arrange to have a^2+b^2=1, which you can do for any line). It is also well worth noting that the sign of ax+by+c tells you which side of the line your point is on. This is extremely useful when you are doing geometry in a computer program - for instance you would probably test test whether a point is in a convex polygon using this kind of formula. I find this form of line equation far more useful than the usual y=mx+c form.
See Point-Line Distance--2-Dimensional -- from Wolfram MathWorld for a derivation

4. Hi, thanks for help. It turns out that the distance btw line and point is rather intuitive. What about a plane and a point? Such as the distance between $L:ax+by+cz+d=0$ and the point $P_0(x_0,y_0,z_0)$ is

$\frac{|ax_0+by_0+cz_0+d|}{\sqrt{a^2+b^2+c^2}}$

5. Originally Posted by noob mathematician
What about a plane and a point? Such as the distance between $L:ax+by+cz+d=0$ and the point $P_0(x_0,y_0,z_0)$ is

$\frac{|ax_0+by_0+cz_0+d|}{\sqrt{a^2+b^2+c^2}}$
That formula is also true. To prove it, notice that the unit normal vector to the plane ax+by+cz+d=0 is $\mathbf{n} = k(a,b,c)$, where $k=\frac1{\sqrt{a^2+b^2+c^2}}$. If you travel t units along this vector, starting from the point $\mathbf{p} = (x_0,y_0,z_0)$ then you get to the point $\mathbf{p}+t\mathbf{n}$. The condition for that point to lie on the plane is $a(x_0+tka) + b(y_0+tkb) + c(z_0+tkc) + d = 0$. Solve that equation for t and you find that the distance from $\mathbf{p}$ to the plane is $|t| = \frac{|ax_0+by_0+cz_0+d|}{\sqrt{a^2+b^2+c^2}}$.