For two lines that are not parallel, b₁ × b₂ is perpendicular to both. The shortest distance is the length of the projection of any joining vector a₂ − a₁ onto that direction.
Using the distance between the two points read off the equations; those points are generally not the closest pair.
SD = |(a₂ − a₁) · (b₁ × b₂)| / |b₁ × b₂|; the numerator is one 3×3 determinant.