How to use it
- Choose how the line is given: an equation or two points.
- Enter the point P, for example
5, 5. - For the equation, enter a, b, c (
3, 4, -10for 3x + 4y − 10 = 0); for two points, enter A and B.
How it works
- Equation: d = |ax₀ + by₀ + c| / √(a² + b²). The foot is P − ((ax₀ + by₀ + c)/(a² + b²))·(a, b).
- Two points: with the direction d = B − A, the parameter t = (P − A)·d / (d·d) gives the foot A + t·d, and the distance is the length from P to the foot. This works the same way in 2D and 3D. In 2D the line equation through A and B is shown too.
Worked example
Line 3x + 4y − 10 = 0, point P(5, 5): 3·5 + 4·5 − 10 = 25, √(9 + 16) = 5, so d = 25/5 = 5. The foot is (5, 5) − 25/25·(3, 4) = (2, 1); check: 3·2 + 4·1 − 10 = 0.
In space: the line through A(0, 0, 0) and B(1, 1, 1) and P(1, 0, 0). t = 1/3, the foot is (1/3, 1/3, 1/3) and d = √(2/3) = 0.8164965809.
Tips and common mistakes
- Forgetting the square root in the denominator is the classic error; |ax₀ + by₀ + c| alone is not a distance unless a² + b² = 1.
- Keep the signs: the line 3x + 4y = 10 has c = −10.
- A t between 0 and 1 means the foot lies between A and B; outside that range it is on the extension of the segment.