## How to compute distance between a point and a line

This semester (Even Semester, 2015-2016) I am teaching a new course, that is called Analytic Geometry or Geometry Analytic, both are the same, I think. Don’t get me wrong, the course is not new, it is just I would be teaching this course the first time. When they told me that I was going to be the lecturer of this course, they did not give me a standard, they did not give me a textbook they normally use, or a list of topics that I must cover, perhaps because this course is not a compulsory course. So, I have a freedom, I can choose topics that I want to teach in Analytic Geometry. The first thing I did, was to browse the internet any textbook about Analytic Geometry or any lecture note. In the end, I pick a textbook (Indonesian book) and I choose some topics of my interest to be the material of this course.

Okay, enough for the background, I am sure you don’t want to hear anymore on that. Let’s get back to main point of this note. Long story short, a straight line became one of the topics in my course, and I was interested on how the formula to compute distance between a point and a line is derived.In this case, I only consider two dimensional case and by distance, I mean the shortest distance between such a point and a certain line, which also means the perpendicular distance. If you don’t remember what is the formula, let me recall you.

Consider a straight line , given by the following equation:

.

Suppose we have a point , then the distance between the point and the straight line is

There are other proofs on how to derive the above formula, but I really really like the proof I am going to show you below. I will divide this note into two section. The first section will talk about a straight line and how to get an equation of a straight line. The latter section will derive the formula.

1. A straight line equation

In high school, I think you must know what conditions we need to have in order to obtain a straight line equation. If we have two points in coordinate we can compute the line equation using the following:

.

If we have a gradient and a point, we can also compute the line equation using the following:

.

Of course, in a problem, we won’t get this information so easily. We have work a bit more to get either two points or one point and a gradient and then we are able to obtain the equation of the straight line.

Before I teach this course, I can only conclude that if you want to know the equation of a straight line you need to know either:

(i) two points, or

(ii) a point and gradient of the line.

But, actually there is a third condition, and if we know this condition, we can also compute the equation of a straight line. In the third condition, a line is assumed to be the tangent line of a certain circle. Thus, the characteristics we need to know to form a line are the radius of the circle and the angle between the radius and the positif axis. See the figure below.

In the figure, we can see that a line can be determined uniquely if the radius of the circle and the angle are known. In the first section of this note, we shall derive how to define a line equation given these two conditions.

Suppose we have a straight line, are are given. See the figure below. Consider the point . We are going to find the relationship of and .

The radius , which is , can be computed by adding and . We shall consider first. Consider triangle which is a right triangle at . We have the relationship:

.

Consider another triangle, , which is also a right triangle at . We have the following relationship

as it can be computed that the angle is also .

Therefore, we have , which is the equation of straight line given that and is known.

Before we discuss how to derive the formula to compute the distance between a point and a line, I would like to discuss how to find and if we know the general equation of a straight line . Consider a line equation, then we move $c$ to the right hand side and multiple both sides with a non zero constant , . We shall choose such that and . Therefore, we have

and

our equation of line becomes:

.

Here, we have that the right hand side of the above equation is , and we choose the positive value to get . The angle can also be computed once we determine .

2. Distance between a point and a line

To compute a perpendicular distance between a point and a line, we shall use the above result. Consider a straight line and a point in the following figure.

We want to compute . In order to do that, we need to make another line that is parallel to the line and passing through point . This line, because it is parallel to and, has the following equation:

Thus the distance between the point and the line can be easily computed by considering the absolute difference between and as follow:

As we know from the first section that we can substitute the latter expression into:

or

which is the same as the formula we mentioned in the beginning of our note.

## Your says