The angle \( \theta \) between vectors \( \vec{a} \) and \( \vec{b} \) is determined using the dot product formula:
\(\vec{a} \cdot \vec{b} = |\vec{a}| |\vec{b}| \cos \theta\)
The dot product \( \vec{a} \cdot \vec{b} \) is calculated as:
\(\vec{a} \cdot \vec{b} = (1)(2) + (2)(-1) + (1)(2) = 2 - 2 + 2 = 2\)
The magnitudes of \( \vec{a} \) and \( \vec{b} \) are:
\(|\vec{a}| = \sqrt{1^2 + 2^2 + 1^2} = \sqrt{1 + 4 + 1} = \sqrt{6}\)
\(|\vec{b}| = \sqrt{2^2 + (-1)^2 + 2^2} = \sqrt{4 + 1 + 4} = \sqrt{9} = 3\)
Substituting these values into the cosine formula yields:
\(\cos \theta = \frac{\vec{a} \cdot \vec{b}}{|\vec{a}| |\vec{b}|} = \frac{2}{\sqrt{6} \times 3} = \frac{2}{3\sqrt{6}}\)
This simplifies to:
\(\cos \theta = \frac{2}{3\sqrt{6}} = \frac{2\sqrt{6}}{18} = \frac{\sqrt{6}}{9}\)
Further simplification results in:
\(\cos \theta = \frac{\sqrt{6}}{9} = \frac{6}{\sqrt{30}}\)
Therefore, \(\theta = \cos^{-1}\left(\frac{6}{\sqrt{30}}\right)\).