[Math] Distance between a point and a line (defined by 2 points)

geometry

I have a point at (4,6) and a line defined by points (-7,9) and (10, 9). How would I find the shortest distance between the point and the line, without converting each into linear equations?

https://imgur.com/a/FUbGMJn

Best Answer

The area of the parallelogram spanned by points $A,B$ (on the line), and $C$ is $$|(B-A)\times (C-A)|=|(x_B-x_A)(y_C-y_A)-(y_B-y_A)(x_C-x_A)|.$$ If we divide this by the length $\sqrt{(B-A)^2}=\sqrt{(x_B-x_A)^2+(y_B-y_A)^2}$ of its base, we obtain ist height.

Final formula: $$\frac{|(x_B-x_A)(y_C-y_A)-(y_B-y_A)(x_C-x_A)|}{\sqrt{(x_B-x_A)^2+(y_B-y_A)^2}}$$

So in your concrete example, the distance is $$ \frac{|(10-(-7))(6-9)-(9-9)(4-(-7))|}{\sqrt{(10-(-7))^2+(9-9)^2}}=3.$$