Step 1: Write the system of equations in matrix form:
\[
\begin{aligned}
2x + py + 6z &= 8
\text{(1)} \\
x + 2y + qz &= 5
\text{(2)} \\
x + y + 3z &= 4
\text{(3)}
\end{aligned}
\]
Step 2: Express the system in augmented matrix form:
\[
\left[
\begin{array}{ccc|c}
2 & p & 6 & 8 \\
1 & 2 & q & 5 \\
1 & 1 & 3 & 4 \\
\end{array}
\right]
\]
Step 3: Use row operations to reduce the matrix. First, make \( R_1 \) as is, and use it to eliminate leading coefficients in \( R_2 \) and \( R_3 \).
\[
R_2 \rightarrow R_2 - \frac{1}{2}R_1,
R_3 \rightarrow R_3 - \frac{1}{2}R_1
\]
Before that, divide \( R_1 \) by 2 for convenience:
\[
R_1 \rightarrow \left[1, \frac{p}{2}, 3, 4\right]
\]
\[
R_2 = [1, 2, q, 5] - [1, \frac{p}{2}, 3, 4] = [0, 2 - \frac{p}{2}, q - 3, 1]
\]
\[
R_3 = [1, 1, 3, 4] - [1, \frac{p}{2}, 3, 4] = [0, 1 - \frac{p}{2}, 0, 0]
\]
Step 4: For the system to have infinitely many solutions, the rank of the coefficient matrix must equal the rank of the augmented matrix, and it should be less than the number of variables.
So, the two reduced rows:
\[
R_2 = [0, 2 - \frac{p}{2}, q - 3, 1],
R_3 = [0, 1 - \frac{p}{2}, 0, 0]
\]
For linear dependence (to get infinite solutions), \( R_2 \) and \( R_3 \) must be linearly dependent.
So the second element of \( R_2 \) should be a multiple of that in \( R_3 \). Try setting:
\[
2 - \frac{p}{2} = 2(1 - \frac{p}{2}) \Rightarrow 2 - \frac{p}{2} = 2 - p
\Rightarrow \frac{p}{2} = p \Rightarrow p = 0 \Rightarrow \text{Contradiction}
\]
Instead, equate the second terms of both \( R_2 \) and \( R_3 \):
\[
2 - \frac{p}{2} = k(1 - \frac{p}{2})
\]
Let’s solve directly for \( p \) using original equations.
Subtract (3) from (2):
\[
(x + 2y + qz) - (x + y + 3z) = 5 - 4 \Rightarrow y + (q - 3)z = 1
\text{(4)}
\]
Subtract (3) from (1):
\[
(2x + py + 6z) - (x + y + 3z) = 8 - 4 \Rightarrow x + (p - 1)y + 3z = 4
\text{(5)}
\]
Use (4) to get \( y = 1 - (q - 3)z \)
Substitute into (5):
\[
x + (p - 1)(1 - (q - 3)z) + 3z = 4
\Rightarrow x + (p - 1) - (p - 1)(q - 3)z + 3z = 4
\]
For infinitely many solutions, the coefficient of \( z \) must vanish:
\[
- (p - 1)(q - 3) + 3 = 0 \Rightarrow (p - 1)(q - 3) = 3
\]
Try \( p = 2 \Rightarrow (2 - 1)(q - 3) = 3 \Rightarrow q = 6 \)
So \( \boxed{p = 2} \) gives a consistent solution.
\[
\boxed{p = 2}
\]