ehild said:
r1 and r2 are the directional vectors of the lines in the formula for the distance.
That's not right. r1 is the displacement vector from the origin to some arbitrary point on line #1, and r2 is the displacement vector from the origin to some arbitrary point on line #2.
What spacetimedude got wrong was his nhat. That's what uses those directional vectors.
spacetimedude said:
The answer says that the r2=k+λ(i+2j+3k) and the final answer is 1/\sqrt{6}.
Could you care to explain why r2=k+λ(i+2j+3k) and when finding n, the answer excludes the lone k in r2=k+λ(i+2j+3k)?
It doesn't matter which point you pick. As I wrote above, r2 represents some arbitrary point on line #2. You can pick any point on the line you want and you'll get the same result. The same answer, 1/√6, results whether you use (0,0,1), (1,2,4), or (10,20,31). The obvious choice here is the point (0,0,1).
That expression r2=k+λ(i+2j+3k) represents the set of all points that lie on the second line.
Suppose you know that \vec p_1 and \vec p_2 are displacement vectors from the origin to two distinct points on some line. Then \vec p_1 + \alpha (\vec p_2 - \vec p_1) where \alpha is some real number will also describe a point on that line.
Here you know that (0,0,1) and (1,2,4) are two points on the second line. The displacement vectors that represent these points are \vec p_1 = \hat k and \vec p_2 = \hat \imath + 2 \hat \jmath + 4\hat k. Using \lambda in lieu of my \alpha (it's just a dummy variable) yields \vec r_2 = \vec p_1 + \lambda (\vec p_2 - \vec p_1) = \hat k + \lambda(\hat \imath + 2 \hat \jmath + 3\hat k).
Also, when doing these kind of problems, does it matter if d=|(r1-r2).n(hat)| and not d=|(r2-r1).n(hat)|? I'm having difficulties trying to figure out which vector to subtract first.
Order doesn't matter. You're taking the absolute value of that inner product. Switch which one you call line #1 and line #2 and you'll get the same result.