Step 1: Direction vectors of the lines.
The direction vector of the first line is:
\[
\mathbf{a_1} = \hat{i} + 2 \hat{j} - \hat{k}
\]
The direction vector of the second line is:
\[
\mathbf{a_2} = 5 \hat{i} + 3 \hat{j} + 4 \hat{k}
\]
Step 2: Formula for the angle between two lines.
The angle \( \theta \) between two lines is given by the formula:
\[
\cos \theta = \frac{\mathbf{a_1} \cdot \mathbf{a_2}}{|\mathbf{a_1}| |\mathbf{a_2}|}
\]
Step 3: Calculating the dot product.
The dot product of \( \mathbf{a_1} \) and \( \mathbf{a_2} \) is:
\[
\mathbf{a_1} \cdot \mathbf{a_2} = (1)(5) + (2)(3) + (-1)(4) = 5 + 6 - 4 = 7
\]
Step 4: Finding the magnitudes of \( \mathbf{a_1} \) and \( \mathbf{a_2} \).
The magnitude of \( \mathbf{a_1} \) is:
\[
|\mathbf{a_1}| = \sqrt{(1)^2 + (2)^2 + (-1)^2} = \sqrt{1 + 4 + 1} = \sqrt{6}
\]
The magnitude of \( \mathbf{a_2} \) is:
\[
|\mathbf{a_2}| = \sqrt{(5)^2 + (3)^2 + (4)^2} = \sqrt{25 + 9 + 16} = \sqrt{50}
\]
Step 5: Calculating the angle.
Now, substitute the values into the formula for \( \cos \theta \):
\[
\cos \theta = \frac{7}{\sqrt{6} \times \sqrt{50}} = \frac{7}{\sqrt{300}} = \frac{7}{10\sqrt{3}} = \frac{\sqrt{3}}{6}
\]
Thus, the angle \( \theta \) is:
\[
\theta = \cos^{-1} \left( \frac{\sqrt{3}}{6} \right)
\]
Step 6: Conclusion.
Thus, the angle between the lines is \( \theta = \cos^{-1} \left( \frac{\sqrt{3}}{6} \right) \).