Suppose that I was asked to find the generator matrix for a $\left[4,2,2\right]$ code.
My first guess would be:
$$\begin{bmatrix}1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \end{bmatrix}$$
Since I know that the generator matrix is of the form:
$$G = \left[ I_k | P \right]$$
And since the rows are linearly independent and a distance of $2$ apart, I would assume that this is a generator matrix.
The solution that I am given is that the $\textbf{standard}$ form of the generator matrix for $\left[4,2,2\right]$ is:
$$\begin{bmatrix}1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 \end{bmatrix}$$
Which confuses me because it would appear that even though it forms a basis, the code words are a distance 4 apart.
I guess that I'm confused as to how to generate a generator matrix, some help would be greatly appreciated.
Best Answer
As far as the distance in the solution gets:
There is a codeword $C(11)=(1,0,1,0)+(0,1,0,1)=(1,1,1,1)$ which is 2 away from $(1,0,1,0)=C(01)$. The distance is the minimum over pairs in the subspace not all pairs of basis elements.