The vector b1×b2 is perpendicular to both lines. Projecting the connecting vector a2−a1 onto this perpendicular direction gives the shortest distance.
If b1×b2=0, the lines are parallel and you need a different formula. If the scalar triple product is zero (lines coplanar), distance is zero — they intersect.
Alternative Method
Set up a perpendicular condition: find λ,μ such that the vector between corresponding points is perpendicular to both direction vectors. Solving two linear equations in λ,μ gives the foot of perpendicular on each line. Slower but more conceptual.
Common Mistake
Students forget the absolute value in the numerator. The dot product can be negative depending on orientation, but distance is always positive. Always wrap with ∣⋅∣.
Before computing the distance, check whether the lines are skew. If (a2−a1)⋅(b1×b2)=0, lines intersect (distance 0). Saves time.
Want to master this topic?
Read the complete guide with more examples and exam tips.