Lecture 3: Some Vocabulary and Parity Check Codes

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?



Hints and Solutions:
  • What are the codewords for the repeat three times code? What about the repeat n times code? For repeating three times the codewords are just 111 and 000.
  • How many bits are in the repeat three times code? What about the repeat n times code? There are n bits in the repeat n times code.
  • What codeword do you get for the message 100? 010? 111? 101? 1001 0101 1111 1010
  • 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? Remember we are only sending codewords with an even number of 1s. Since 0111 doesn't have an even number of 1s, it is probably not something that was sent by the parity check code. Still, to figure out what was sent, we would need to know where the transmission went wrong, and we don't, since we could make a lot of things that could have been sent by the parity check code and went a little bit wrong to get 0111.
  • 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? If one bit is changed, we have an odd number of bits, and therefore not a valid code word, however, if two bits are changed we again have an even number of bits and a valid codeword. Every time we change one more bit, we change to an odd number of 1s and an invalid codeword, but if we changed an even number of bits, we again have an even number of 1s and a valid codeword.


    This work was made possible through a grant from the National Science Foundation.