We are given the vectors:
\[
p = \hat{i} + \hat{j}, \quad q = 4\hat{k} - \hat{j}, \quad r = \hat{i} + \hat{k}
\]
We need to find the unit vector in the direction of \( 3p + q - 2r \).
First, calculate \( 3p + q - 2r \):
\[
3p = 3(\hat{i} + \hat{j}) = 3\hat{i} + 3\hat{j}
\]
\[
q = 4\hat{k} - \hat{j}
\]
\[
-2r = -2(\hat{i} + \hat{k}) = -2\hat{i} - 2\hat{k}
\]
Now, combine the vectors:
\[
3p + q - 2r = (3\hat{i} + 3\hat{j}) + (4\hat{k} - \hat{j}) + (-2\hat{i} - 2\hat{k})
\]
\[
= (3\hat{i} - 2\hat{i}) + (3\hat{j} - \hat{j}) + (4\hat{k} - 2\hat{k})
\]
\[
= \hat{i} + 2\hat{j} + 2\hat{k}
\]
Now, the magnitude of the vector is:
\[
|\hat{i} + 2\hat{j} + 2\hat{k}| = \sqrt{1^2 + 2^2 + 2^2} = \sqrt{9} = 3
\]
Thus, the unit vector is:
\[
\frac{1}{3} (\hat{i} + 2\hat{j} + 2\hat{k})
\]