21. Distance of a Point From a Line

In this lesson, we’ll derive the expression of the perpendicular distance of a point from a line. Let’s discuss two different methods. I’ll cover a third one later.

Method I

Suppose we have a line ax + by + c = 0 and a point P(x1, y1).

distance of a point from a line

How can we find the perpendicular distance of P from the line (i.e., PQ in the figure above)?

One way to find PQ is to apply the distance formula. But for that, we’ll need the coordinates of Q. And for that, we’ll need the equation of PQ. Can we find it?

Turns out we can. PQ is a line passing through P and perpendicular to the given line, whose slope is -a/b. This means that the slope of PQ equals b/a. (Go back here in case you’re not sure how we got this.)

So, using the point slope form, the equation of PQ is:

(y – y1) = b/a(x – x1)

On solving this equation with PQ, we’ll get the coordinates of Q as:

((b2x1 – aby1 – ac)/(a2 + b2), (a2y1 – abx1 – bc)/(a2 + b2))

Ew.

Finally, we’ll get the distance PQ as:

|ax1 + by1 + c|/√(a2 + b2)

I skipped the gory details there. You can do the calculations yourself (at your own risk).

Though the final expression looks fairly simple, the method was quite complicated, and I wont recommend it. Let’s try a different way.

Method II

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

distance of a point from a line

We joined P to the points of intersection, A and B, of the line with the axes.

The idea here is to find the area of ΔPAB using two different ways (one of which involves PQ), and then equate the two expressions to find PQ.

We already know one method to find the area of a triangle, given its vertices. To apply that, we’ll need the coordinates of A and B. Let’s find those.

Since A lies on the X axis, its y-coordinate equals zero. Since it also lies on the given line, we can find the x-coordinate by substiting y = 0 in the given line. We’ll get:

ax + y(0) + c = 0

⇒ x = -c/a

Therefore, the coordinates of A are (-c/a, 0). Similarly, the coordinates of B are (0, -c/b).

Finally, the area of the triangle equals:

1/2 |x1 (0 – (-c/b)) + (-c/a)(-c/b – y1) + 0(y1 – 0)|

= 1/2 x |c/ab| x |ax1 + by1 + c|

This area ΔPAB also equals:

1/2 x AB x PQ

= 1/2 x √[(c/b)2 + (c/a)2] x PQ

= 1/2 x |c/ab| x √(a2 + b2) x PQ

After equating these two expressions, we’ll finally get:

PQ = |ax1 + by1 + c|/√(a2 + b2)

Not as messed up as the previous method, but still a bit lengthy. Anyways, we got what we needed.

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

Lesson Summary

  1. The perpendicular distance of a point P(x1, y1) from a line ax + by + c = 0 is given by |ax1 + by1 + c|/√(a2 + b2).

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

PS: In the second method, a, b, and c are all assumed to be non-zero. Things will be different in case any of them equals zero. But the final expression would be the same. Why don’t you try deriving the same?

Leave a Reply

Scroll to Top