$\text{$x_1=x_2=x_3$}$
$\text{$x_4=x_5=x_6$}$
$…...$
$…...$
$x_{3n-2} = x_{3n-1} = x_{3n}$
$\text{So, solution space is $\left \{\begin{pmatrix} x_1\\ x_1\\ x_1\\ x_4\\ x_4\\ x_4\\ ...\\ x_{3n-2}\\ x_{3n-2}\\ x_{3n-2}\\ \end{pmatrix}\right\}$}$
$\text{$= \left\{ x_1\begin{pmatrix} 1\\ 1\\ 1\\ 0\\ 0\\ 0\\ ...\\ 0\\ 0\\ 0\\ \end{pmatrix} + x_4\begin{pmatrix} 0\\ 0\\ 0\\ 1\\ 1\\ 1\\ ...\\ 0\\ 0\\ 0\\ \end{pmatrix} + …… +x_{3n}\begin{pmatrix} 0\\ 0\\ 0\\ 0\\ 0\\ 0\\ ...\\ 1\\ 1\\ 1\\ \end{pmatrix} \right\}$} \rightarrow{(1)}$
$\text{So, solution space contains $3n/3 = n$ basis vectors which are:}$
$\text{$ \left\{\begin{pmatrix} 1\\ 1\\ 1\\ 0\\ 0\\ 0\\ ...\\ 0\\ 0\\ 0\\ \end{pmatrix}, \begin{pmatrix} 0\\ 0\\ 0\\ 1\\ 1\\ 1\\ ...\\ 0\\ 0\\ 0\\ \end{pmatrix} , …… ,\begin{pmatrix} 0\\ 0\\ 0\\ 0\\ 0\\ 0\\ ...\\ 1\\ 1\\ 1\\ \end{pmatrix} \right\}$}$
$\text{These vectors are orthogonal and so they form a linearly independent set and }$
$\text{from (1), it is clear that they span the whole solution space.}$
$\text{Hence, subspace $S$ has dimension $n.$}$