Before the formal definition is given, let us go straight to an example.
``Hi Bob'' (louder).
``Hi Bob'' (even louder).
This illustrates a ``repetition code''. More precisely, the -ary repetition code of length is the set of all -tuples of the form , for . (We leave it as an exercise to verify that this is a vector space over .) We think of as representing information you want to send. It could be the ``greyness'' of a pixel in a picture or a letter (represented in ASCII code) in a word, for example. Since the channel might contain noise, we send instead, with the understanding that the receiver should perform a ``majority vote'' to decode the vector. (For example, if was received then 0 ``wins the vote'').
This wasn't a very efficient example. Let's try again.
First, write the number in binary, 0 as , as , ..., as . If for , then define
For example, or is encoded as . Let denote the set of all vectors where , for , and are defined as above. In other words, define
This is a dimensional vector space over . Why is this not a ``good'' code? Suppose for instance Alice wants to send the number to Bob. In binary, is , so she encodes as . Suppose Bob receives . Bob knows that an error occurred in transmission since , so . Suppose only one error occurred. (This is more likely than having two or more errors, and it is easier to detect exactly one error that two or more.) Where did the error occur? Bob doesn't know where since is just as close to as it is to in the sense that they differ by the same number of bits. He can't tell which is correct.
The problem with this example boils down to the fact that the first and second column of are the same. We shall explain this type of deficency more later.