Distance of a point from a line

Distance of a point from a line

I’ll illustrate two different methods (and one more later) to derive the expression for the perpendicular distance of a point from a given line.

Here is the situation..

Distance of a point from a straight line in the Cartesian Plane

Fig 1.: The distance to be calculated

We’ve been given a line ax + by + c = 0, and a point P(x1, y1). And we’re supposed to calculate PN, i.e. the perpendicular distance of P from the given line.

Method I

We can think in this way:

First, we can find the equation of PN — a line perpendicular to ax + by + c = 0, and passing through P(x1, y1).

Then, the coordinates of N can be found by solving the equation of PN with the given line.

Finally, the distance between P and N can be calculated using distance formula.

Alright, seems good. The equation of PN is bx – ay – bx1 + ay1 = 0. (Details skipped !)

Next, the coordinates of N are \( (\frac{b^2x_1- aby_1 – ac}{a^2+b^2}, \frac{a^2y_1- abx_1 – bc}{a^2+b^2})\) (Details skipped again!)

And finally, the distance PN = \(|\frac{ax_1+by_1+c}{\sqrt{a^2+b^2}}|\) (Details skipped yet again! I suggest you do all the calculations yourself to ensure I didn’t fool you.)

That seemed like an ugly method (strange looking coordinates, and distance formula!) to get the answer.

The point is to illustrate what I said at the very beginning – there are (in general) multiple ways to go about solving a problem in coordinate geometry. Some are good, others are not so good.

Method II

This one is not as obvious as the previous one. Have a look at the following figure.

Distance of a point from a straight line in the Cartesian Plane

We’ll calculate the area of the triangle PAB using two different expressions and equate them.

The area of ΔPAB = 1/2.AB.PN = 1/2.\(\sqrt{(c/b)^2+(c/a)^2}\).PN = 1/2 |c/ab|\(\sqrt{a^2 + b^2}\)

We can also write the area of the triangle using the coordinates of its vertices. This comes out to be 1/2.|c/ab|.|ax1+by1+c|

After equating these two expressions we get PN =|ax1+by1+c|/\(\sqrt{a^2 + b^2}\)

Note that I’ve assumed a, b, c all to be non-zero. Things will be different in case any of them equals zero. But the final expression would be the same.

Lesson Summary

  1. The perpendicular distance of a point P(x1, y1) from a line ax+by+c=0 is given by \(\frac{|ax_1+by_1+c|}{\sqrt{a^2 + b^2}}\)

I’ll talk about one more method of finding the distance PN a bit later (when I cover the parametric form of the equation to the straight line.)

Next, I’ll cover a few examples related to this formula.

Leave a comment