Calculates the distance between the line ax + by + c = 0 and the point (x, y) as |ax + by + c| ÷ √(a² + b²). The nearest point on the line, the foot of the perpendicular, is also shown.
This finds the distance between the line and the point , meaning the length of the perpendicular dropped from the point to the line.
, and are the coefficients of the line, is the point and is the distance. The nearest point on the line, the foot of the perpendicular, is also given.
The top, , is what you get by putting the point into the equation of the line. It is 0 when the point lies on the line and grows as the point moves away. That value scales with the size of the coefficients, so dividing by turns it into a length that does not depend on how the line was written. The absolute value keeps the distance positive on either side of the line.
For the line and the point , the top is and the bottom is , so . The foot of the perpendicular is .
Write the line as . A line given as becomes .
With and both 0 the equation is not a line at all, so nothing can be calculated.