Find the point on the line
nearest to .
Use orthogonal projection. The nearest point on a line through the origin is the projection of onto the direction :
The characterising property is that the residual is perpendicular to ; that perpendicularity is what makes the distance smallest.
Compute the two dot products. With and :
Find the parameter and the point.
Verify the perpendicularity. The residual vector from the foot to is
and its dot product with the direction is . A zero dot product is proof, not evidence — no other point on the line has this property.
Read off the minimum distance as a by-product.
Testing neighbouring parameters confirms it is a minimum: at the distance is and at it is also , both larger than .
Need to solve a different problem like this? Open the solver →