Before we go any further, lets stop and get some better vocabulary to describe the codes that we are creating. We will call a string of 0s and 1s that we might send for any given code a codeword. What are the codewords for the repeat three times code? What about the repeat n times code? We will call a given digit of either 0 or 1 in a code a bit. How many bits are in the repeat three times code? What about the repeat n times code?
Now we are going to describe a new kind of code. It is called the parity check code on n bits. Let us assume we would like to transmit any string of 0s and 1s and figure out if an error was made. Here is how the code works: we start with the message, that is, the string of 0s and 1s that we wish to transmit, take the example 011 for n = 3. Now we add up all of the 1s that are listed in the message, in our example we get 2. Then, we add one more bit to the end of our message, a 1 if this sum is odd and 0 if it is even, so in the case of our example message, we get the codeword 0110. This is the codeword we transmit. Notice that this means that we only transmit code words is an even number of 1s. What codeword do you get for the message 100? 010? 111? 101?
So what good does this encoding do for us? Say you know that someone is using a parity check code on 3 bits, and you get the codeword 0111. What can you say about the likelyhood that this is the codeword that the sender sent? If it isn't the codeword that was sent, can you recover the one that was sent? Why or why not?
The parity check code is an example of a code that only detects errors, but does not correct them. What happens if only one the of the bits in the codeword is changed during transmission? Do you get a valid codeword? What about if two bit are changed in transmission? Three? Do you see a pattern in when you can detect errors and when you can't using the partiy check code?