David W. answered 03/23/19
Experienced Prof
In Plane Geometry a Point C(x.y) may be on line L (either within or outside segment AB). When it is on the line, the distance is zero.
If C(x,y) is not on line L, then imagine larger and larger circles (of increasing radius r) that increase until the circle first touches line L. This radius is the "shortest" distance to line L and this radius is perpendicular to line L. That means that if you have the formula for line L, you may find the formula for all perpendicular lines and the formula for the particular perpendicular line that includes point C(x,y),
The distance is found by using the point C(x,y), the center of the circle, and the intersection point of these two lines [using the distance formula, of course]
The variation that you mention is for the distance between a point and a line segment. In this case, the intersection of the two perpendicular lines may be outside the line segment, so additional math is required [for example, use the distance formula with point C(x,y) and the endpoint A or B, whichever is closest to C(x,y)].
Now, if the formula for line L (which includes line segment AB) is not given, you may use the two-point formula for the equation of a line (use point A and point B)..Remember that all perpendicular lines have a slope that is the negative reciprocal of the slope of line L.
[note: These are steps, not just one formula, so you need the formula for line L to proceed.]
- Find the formula for line L (containing line segment AB).
- Find the formula for the line perpendicular to line L that goes through point C(x,y).
- Find the point D(x1,y1) that is the intersection of those two lines (that is, x1 any y1 satisfy both equations).
- Use the distance formula with C(x,y) and D(x,y). This is the distance from point C(x,y) to line segment AB.