The distance between a point and a line, is defined as the shortest distance between a fixed point and any point on the line. It is the length of the line segment that is perpendicular to the line and passes through the point.
The distance from a point to the line is
From the figure above let be the perpendicular distance from the point to the line We also let be a vector normal to the line that starts from point .
We can see from the figure above that the distance is the orthogonal projection of the vector . Thus we have from trigonometry:
Now, multiply both the numerator and the denominator of the right hand side of the equation by the magnitude of the normal vector
We know from the definition of dot product that just means the dot product of the vector and the normal vector
And we also have thus
From the equation of the line we have which implies
So given a line of the form and a point the perpendicular distance can be found by the above formula.
Find the distance between the line and the point ,
From the distance formula we have:
Find the distance between the line and the point .
The distance formula can be reduced to a simpler form if the point is at the origin as:
So we have: