Any arbitrary point along the line L1 is P = (x, y, z) = (1 + 3t, 3 + t, −2t):
And point along the line L2 is Q = (x, y, z) = (1 + s, −1, 5 − 2s):
The vector connecting these two arbitrary points is:
PQ = Q - P = [1 + s − (1 + 3t), −1 − (3 + t), 5 − 2s − (2t)]
PQ = (s − 3t , −4 − t , 5 − 2s + 2t)
The shortest line will be the vector PQ which is perpendicular to both lines direction numbers e1 and
e2, the values of t and s will assure us that line PQ is the shortest line despite the fact that we choose initially two
arbitrary points on both lines L1 and L2 to calculate PQ,
from the dot product we have the values:
PQ ⟘ e1 = PQ e1 = 0 and PQ ⟘ e2 = PQ • e2 = 0
e1 = (3, 1, −2) e2 = (1, 0, −2)
(s − 3t , − 4 − t , 5 − 2s + 2t) ‧ (3, 1, −2) = 0
(3s − 9t − 4 − t − 10 + 4s −4t) = 0
14t − 7s = −14
(s − 3t , −4 − t , 5 − 2s + 2t) ‧ (1, 0, −2) = 0
(s − 3t + 0 − 10 + 4s − 4t) = 0
7t − 5s = −10
And we get two equations with the unknowns t and s. After solving this equations, we get the values:
t = 0 and s = 2.
Substituting these values into the vector PQ we get: PQ = (2 , −4 , 1)
The length of PQ is the shortest distance between the lines:

The points of intersection of the shortest line with line L1 and L2 are:
L1: (1 , 3 , 0) and L2: (3 , −1 , 1)
Another way to solve the problem is to find the vector perpendicular to both given lines by cross product their direction numbers:

The unit vector in the n direction is:
To find the vector PQ we choose any two arbitrary points along the lines L1 and L2
let say: t = 0 then (1 , 3 , 0) and s = 0 then (1 , −1 , 5).
PQ = (1 − 1 , 3 + 1 , 0 −5) = (0 , 4 , −5)
The shortest line length is the projection of PQ on the unit vector (
).
