Example 3.3.1
``Hi Bob''.
``What?''
``Hi Bob'' (louder).
``What?''
``Hi Bob'' (even louder).
``Oh, hi.''
This illustrates a repetition code. More precisely,
the

-ary repetition code of length

is the
set of all

-tuples of the form

, for

.
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'').
Example 3.3.2
In this example, we will design a code which will send
a number in

to another person.
We will see that in fact our design is not well-thought
out. Hopefully, this flaw will motivate us to do a better
job later.
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
where
This is a

dimensional vector space over

.
Why is this not a ``good'' code? Suppose for instance
Alice wants to
send the number

or

, 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 since

is ``near''

and
it is ``near''

. 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 explore this more later.
Definition 3.3.3
Let

be a finite field. A subset

of

is called
a
code of length 
. A subspace of

is called a
linear code of length 
.
If

then

is called a
binary
code. If

then

is called a
ternary
code. If

has

elements then

is called
a
-ary code. The elements of a code

are
called
code words or
code vectors.
Sometimes elements of

which do not
necessarily belong to

are called ``received vectors''.
The
information rate of

is
where

denotes the number of elements of

.