The set of length-4 binary words containing at least two occurrences of $\sa{1}$ has 11 elements, all $16$ 4-bit words except the $5$ words 0000, 0001, 0010, 0100,1000.
A possible $(7,4)$-code is \[f(b_0,\,b_1,\,b_2,\,b_3)\,=\, [b_0+b_1+b_2,\, b_0+b_1+b_3,\, b_0+b_2+b_3].\] \[ \begin{array}{ll} \code(b_0,\,b_1,\,b_2,\,b_3)\,=\, & [b_0,\,b_1,\,b_2,\,b_3,\, b_0+b_1+b_2,\\ & b_0+b_1+b_3,\, b_0+b_2+b_3]. \end{array} \] where $b_i$ are bits and the operation $+$ is $xor$.
The matrix of this $(7,4)$-code is $$M = \left(\begin{array}{cccc} 1 & 1 & 1 & 0 \\ 1 & 1 & 0 & 1 \\ 1 & 0 & 1 & 1 \end{array}\right) $$ then $\code^M(1010) = 1\,0\,1\,0\ 0\,1\,0$, in this case $f(1010)=010$.
Problem 132: 1-error correcting linear Hamming codes |
Sending a message through a noisy line may produce errors. The goal of the problem is to present a method for correcting a message in which only one error is assumed to occur. A message is a word of bits. To allow checking and correcting a possible transmission error in a word $w \in \{\sa{0},\sa{1}\}^*$, a very short word depending on it and easily computable, $f(w)$, is appended to $w$. The complete message to be sent is then $\code(w)=w\cdot f(w)$.
We assume that the length of a message $w$ is of the form $k=2^r-r-1$, $|f(w)|=r$ and the total length of the code is then $n=k+r=2^r-1$, for an integer $r\gt 2$. Hence, the size $r$ of the additional part of the code is only logarithmic according to length of the message. Such codes are called $(n,k)$-codes. We consider only binary words and use linear algebra methods. A word $b_1b_2\cdots b_k$ is identified with the vector $[b_1,b_2,\ldots, b_k]$.
We construct $f(w)$ as $M\times w^T$, multiplication of a $r\times k$ matrix $M$ by the transposed vector associated with $w$. Then, $$\code^M(w) = [w,f(w)] = [w,M\times w^T].$$
The length-$n$ elements of $\Codes^M_n=\{\code_n^M(w):\, w\in \{0,1\}^k\}$ are called codewords and the set $\Codes^M_n$ is called a Hamming code if $$(*)\ \ \ \min\,\{\ham(u,v)\;:\; u,v\in \Codes^M_n, u\ne v\,\}\geq 3,$$ where $\ham(u,v)$ is the Hamming distance (number of mismatches).