This is definitely a duplicate question but I'm not asking for a formula. I have a formula that I found somewhere but I don't understand how it works.
On a (two-dimensional) Euclidean plane, suppose you have a line segment with end points AB and a point C.
The distance of C from AB is (B.x - A.x) * (A.y - C.y) - (B.y - A.y) * (A.x - C.x)
Edit: The objective was to find the shortest distance from the line segment AB and point C, where the distance(line segment) is perpendicular to the line segment AB. We can assume that points A and B are the leftmost and rightmost points, where C is between them
Question: how does this formula meet this objective?