Distance between point and line


Point to Line DistanceA foundational exercise in algebra is finding the distance between a given point and a given line.
SOP for doing this involves about three simple, intuitive steps. For some situations, however, a single-step solution is desirable.
I've generally left out intermediate steps just to keep the page from being filled with a lot of calculations. If you want to skip even the small bit posted here, you can go right to the bottom line. It won't hurt my feelings.

Given:
Line y = mx + b
and
Point (p, q)

1.
Perpendicular slope = -1/m

1a.
Use point-slope form to find perpendicular line:
y - q = -1/m(x - p)
y = (p + qm - x)/m

2.
Find abscissa of the intersection of given and perpendicular lines:
mx + b = (p + qm - x)/m
x = (p + qm - bm)/(m² + 1)

2a.
Find ordinate of that intersection:
y = m(p + qm - bm)/(m² + 1) + b
y = (b + m(p + qm))/(m² + 1)

2b.
Intersection Point:
(x, y) = ((p + qm - bm)/(m² + 1), (b + m(p + qm))/(m² + 1))

3.
Use distance formula to find distance, h, between (p, q) and intersection point:
h² = (p - (p + qm - bm)/(m² + 1))² + (q - (b + m(p + qm))/(m² + 1))²
h = √((b + mp - q)² / (m² + 1))

No comments: