§ Distance between lines in nD
§ Subproblem: point-line distance in nD
- Intuitlvely, given a point and a line (greek letters will be reals, all else vectors), we must have that the line that witnesses the shortest distance from to must be perpendicular to .
- For if not, we would have some "slack" that we could spend to shorten the distance. Alternatively, using Lagrange multipliers intuition, the gradient must be perpendicular to the level surface of the constraint. In this case, we are tryng to find a point that minimizes distance such that . The ladder is a lagrange constraint, and hence defines a level surface to which the optimal solution must be perpendicular to.
- Some calculus to prove this Let be a point on the line . We extrmize the length as a parameter of :
- This tells us that the line is perpendicular to the direction , which is the direction of the line . Hence, the line from the point to the line with minimum distance is orthogonal to the line itself.
§ Line-Line distance
- We can take two parametric points on two lines , and , and build the line which witnesses the shortest distance.
- From the above derivation, we see that the line must be perpendicular to both and , since we can view line-line-distance as two simultaneous point-line-distance problems: distance from point to line , and distance from point to line .
- This gives us the equations , and . We have two variables and two equations, so we solve for .
- This allows us to find the line whose length is the shortest distance.