The shortest distance between two skew lines is given by the formula:
\[
d = \frac{|\vec{a} - \vec{b} . (\vec{v_1} \times \vec{v_2})|}{|\vec{v_1} \times \vec{v_2}|}
\]
Where:
- \( \vec{a} \) and \( \vec{b} \) are position vectors of points on the first and second lines respectively.
- \( \vec{v_1} \) and \( \vec{v_2} \) are the direction vectors of the two lines.
From the parametric equations:
1. For the first line: \( \vec{a} = i + 2j + k \), and the direction vector is \( \vec{v_1} = i - j + k \).
2. For the second line: \( \vec{b} = 2i - j - k \), and the direction vector is \( \vec{v_2} = 2i + j + 2k \).
Now, calculate \( \vec{v_1} \times \vec{v_2} \):
\[
\vec{v_1} \times \vec{v_2} = \begin{vmatrix} \hat{i} & \hat{j} & \hat{k}
1 & -1 & 1
2 & 1 & 2 \end{vmatrix}
\]
\[
= \hat{i} \begin{vmatrix} -1 & 1 \\ 1 & 2 \end{vmatrix} - \hat{j} \begin{vmatrix} 1 & 1 \\ 2 & 2 \end{vmatrix} + \hat{k} \begin{vmatrix} 1 & -1 \\ 2 & 1 \end{vmatrix}
\]
\[
= \hat{i}((-1)(2) - (1)(1)) - \hat{j}((1)(2) - (1)(2)) + \hat{k}((1)(1) - (-1)(2))
\]
\[
= \hat{i}(-2 - 1) - \hat{j}(2 - 2) + \hat{k}(1 + 2)
\]
\[
= -3\hat{i} + 0\hat{j} + 3\hat{k}
\]
So, \( \vec{v_1} \times \vec{v_2} = -3\hat{i} + 3\hat{k} \).
Next, calculate \( |\vec{v_1} \times \vec{v_2}| \):
\[
|\vec{v_1} \times \vec{v_2}| = \sqrt{(-3)^2 + 0^2 + 3^2} = \sqrt{9 + 9} = \sqrt{18} = 3\sqrt{2}
\]
Now, calculate \( \vec{a} - \vec{b} \):
\[
\vec{a} - \vec{b} = (i + 2j + k) - (2i - j - k)
\]
\[
= i + 2j + k - 2i + j + k = -i + 3j + 2k
\]
Finally, calculate the dot product \( (\vec{a} - \vec{b}) . (\vec{v_1} \times \vec{v_2}) \):
\[
(\vec{a} - \vec{b}) . (\vec{v_1} \times \vec{v_2}) = (-i + 3j + 2k) . (-3\hat{i} + 3\hat{k})
\]
\[
= (-1)(-3) + (3)(0) + (2)(3) = 3 + 0 + 6 = 9
\]
Now, substitute into the formula for distance:
\[
d = \frac{|9|}{3\sqrt{2}} = \frac{9}{3\sqrt{2}} = \frac{3}{\sqrt{2}} = \frac{3\sqrt{2}}{2}
\]
Final Answer:
The shortest distance between the lines is \( \boxed{\frac{3\sqrt{2}}{2}} \).