Distance from a point to a line formula
Let D be a straight line whose equation is given by where are not simultaneously 0, and a point A outside the line, that is not belonging to the line.
The goal is to find the shortest distance between the line D and point P. Let the point where the shortest line segment intersects the line be Q whose coordinates are .
The distance between the point and the line D is the same as the length of the line segment formed by points A and Q or the distance between them. We can use the distance formula to do so but we need to know the coordinates of Q in terms of for that purpose.
The distance between a point and a line, StudySmarter Originals
Recall that the gradient of a line with equation is given by . Now the line segment AQ is perpendicular to the line so its slope will be . The reason being that the product of slopes of two perpendicular lines is always -1 that is.
We now have the slope of the line joining AQ and the coordinates of a point A on it. Using this information, we can now form the equation of line AQ,
Since Q lies on this line, we can substitute for to find the unknowns .
But Q also lies on the line , so it will satisfy the equation of line D, hence we have
The above two lines intersect at Q and hence can be solved simultaneously in order to determine the unknowns , writing the first equation in terms of ,
Substituting the expression of in , we get
Solving for we get,
Expanding the brackets and rearranging the terms, we get
Multiplying both sides by , we get
Now we shall divide by , to get
Substituting this back into to determine , we get
Reducing to a common denominator, we get
Upon simplification, we have
Upon further simplification by eliminating the like terms, we get
Now we have obtained the coordinates of point Q in terms of the constants we know,
Now we can calculate the distance between A and Q using the distance, which is nothing but the distance from the point to the line as we discussed earlier. Let us denote it by d and apply the distance formula,
Substituting for we get
Upon further simplification, we get
Taking the square root on both sides, we get,
Since d is distance, it cannot be negative so we reject the negative root, giving us,
But there is still a possibility when the numerator is negative. To avoid it being negative, its modulus has to be taken,
We don’t run into that problem since the denominator is a sum of squares of non-zero numbers, so it will always be positive.
To write the same expression in a more convenient (and easy to remember) form, let us define the equation of the line as to get , leaving us with,
Now let us apply this formula through a couple of examples.