Dual code , basis matrix, check matrix Suppose that we have the dual code $C=\{0000,0100,0101,0001\}$
A basis matrix is the following:
$$G=\begin{pmatrix}
0 & 1 & 0 & 0\\ 
0 & 1 & 0 & 1
\end{pmatrix}$$
How do we get this matrix? Since we have at the code only $0$s and $1$s, do we just take as rows each possible combination of pairs containing $0$ and $1$ ?
If so, how do we know the order in which we write the pairs?
Also we can only calculate the  check matrix if we know the basis matrix, right?
Why is it $$H=\begin{pmatrix}
0 & 0 & 1 &0 \\ 
1 & 0 & 0 &0 
\end{pmatrix}$$ in this case?
Also the parameters of the code are $[n,k,d]$ where $d(C)=\min_{x,y \in C, x \neq y} d(x,y)$ , we have $k$ digits of information , we encode them in $n$ digits and send them.
We have that $d(0000,0100)=1$ so $d(C)=1$, right?
Does it hold that $n=4$ since each element of $C$ contains 4 digits?
How do we calculate $k$ ? 
 A: Extended hints/explanations:


*

*A binary linear code $C$ is a vector space over the field $\Bbb{F}_2=\Bbb{Z}/2\Bbb{Z}$. Any such matrix that its rows form a basis of $C$ can be used as a generator matrix. For example, the order of the rows does not matter. You can perform any number of elementary row operations to a generator matrix, and you get another generator matrix for $C$. This is because the code really is the row space of a generator matrix. You hopefully recall from linear algebra that doing row operations will not change the row space.

*Correct, the minimum distance of this code is $d=1$. When the code is known to be linear, its minimum distance is equal to the lowest non-zero weight of a codeword.

*Correct, the length of the code $n$ gives the number of symbols in all words of a code. In this case $n=4$. This holds for all block codes. With other kinds of codes (such as convolutional codes) this is no longer true, but it looks like your question is only about block codes.

*The dimension of a code $k$ (IIRC I've seen it also called the rank. Or, more fittingly, the number of information bits) is its dimension as a vector space. This number is also equal to the number of rows of a generator matrix.

*Any generator matrix of the dual code $C^\perp$ of a given code can be used as (parity) check matrix for the code $C$. And vice versa, a generator matrix for $C$ can be used as a check matrix for $C^\perp$. From linear algebra we deduce that if $C$ has dimension $k$ and length $n$, then $C^\perp$ has dimension $n-k$. So in the case $n=4$, $k=2$, if you find $4-2=2$ linearly independent check equations, you have found a check matrix. If all the words of a code have a zero in some position, then the word with $1$ in that position and zeros elsewhere belongs to the dual code. Do you see why?


A mild warning: sometimes it is convenient to have redundant check equations when defining a code. Adding those may make some properties more apparent by adding symmetry to the set of check equations. Or, those extra checks may help the decoding process. Judging from your questions you can ignore warning for now.
