A line through a point meeting a given line at right angles, and the distance from a point to a line
Let A be a point and β the line r = B + t d. Of all points of β, one is closest to A: the foot of the perpendicular, C. The segment AC is perpendicular to β, so AC Β· d = 0. Method 1. (1) Write a general point of β as C = B + t d, with t still unknown. (2) Form AC = C β A, whose components contain t. (3) Put AC Β· d = 0: this is a linear equation in t. (4) Solve it, put t back to get C and AC. Then the distance from A to β is βACβ, and the line through A that meets β at right angles is r = A + sΒ·AC (in space there is just one line through A that meets β at right angles; many other lines through A are perpendicular to β in direction but never meet it). Method 2 uses the vector product and needs no unknown. Take any point B of β. The parallelogram on BA and d has area βBA Γ dβ, and its base is βdβ, so its height, the distance from A to β, is βBA Γ dβ/βdβ. This gives the distance but not the foot. Check any answer by two tests: AC Β· d must be 0 and C must be on β.
Shortest path. Put a pencil on a table as the line and a coin as the point A. Use a ruler to find the shortest distance from the coin to the pencil and notice where the ruler touches the pencil: that is the foot, and the ruler is perpendicular to the pencil.