A one error correcting code

We consider the numbers 0, ..., 15 in their binary notation, i.e., sequences of length 4 where each element is either 0 or 1. So

0 = (0000)2,  6 = (0110)2  and   13 = (1101)2.

Since this notation is unique, a mistake in reading causes a wrong number to be read. The following can help to prevent this. We extend the binary numbers of length 4 by three judiciously chosen bits. The resulting 7 digits over the alfabet {0, 1} can be written as vectors in (Z/2Z)7 or as strings, whatever is more convenient. Thus, (0,0,1,0,0,1,1) can also be written as 0010011.

The first 4 coordinates form the binary notation of the number. Let x be a number in {0, ..., 15}. In the applet we put in the positions a, b, c, d the digits 0 or 1 in such a way that abcd forms the binary notation of x. We then fill the positions e, f, g in such a way that any circle in the picture below contains an even number of zeros. Now the code word for the number x is abcdefg.

The figure can also be used to determine the number x {0, ..., 15} whose code word differs in at most one position from a given vector r (Z/2Z)7. Given r, change at most one position in such a way that we get an even number of ones in each circle. Then the number x is the number with binary notation abcd. This is the so-called one error correcting capacity of the code.