Next: -codes and error correction
Up: Error-correcting codes
Previous: Basic results on codes
  Contents
  Index
The Hamming metric
We've seen so far come simple examples of codes.
What is needed is some notion of how to compare codewords.
Geormetrically, two codewords are ``far'' from each other
if there are ``a lot'' of coordinates where they differ.
This notion is made more precide in the following
definition.
Definition 3.4.1
If

,

are vectors in

then we define
to be the
Hamming distance between

and

. The function

is called the
Hamming metric. The
weight of a vector
(in the Hamming metric) is

.
Note that
 |
(3.1) |
for any vectors
(or, more generally,
any vectors in a linear code).
Using this, it is easy to show that
satisfies the
properties of a metric:
-
for all
and
if and only if
.
-
, for
all
.
-
,
for all
.
Let
and let
This is called the ball of radius
about
.
Since
is finite, this ball has only a finite number of elements.
It is not hard to count them using a little bit of basic combinitorics.
Since this count shall be needed later, we record it in the following
result.
proof:
Let
This is called the shell of radius
about
.
It is consists of all vectors with exactly
coordinates
different from
. There are
ways to choose
out of
coordinates. There are
ways to choose these
coordinates to be
different from those in
. Thus,
Example 3.4.3
If

and

then
is called the
ISBN code. This is an

-ary linear code of length

.
This is the same code used
in book numbering except that the number

is denoted by

on the inside cover of a book.
For example,

and

are code words.
Their Hamming distance is

.
Example 3.4.4
The U. S. Post Office puts a bar code on each letter
to help with its delivery. What are these funny symbols?
Translated into digits, they are given in the following
table.
|
number |
bar code |
|
|
|
|
1 |
| | | | | |
|
|
|
|
|
|
|
2 |
| | | | | |
|
|
|
|
|
|
|
3 |
| | | | | |
|
|
|
|
|
|
|
4 |
| | | | | |
|
|
|
|
|
|
|
5 |
| | | | | |
|
|
|
|
|
|
|
6 |
| | | | | |
|
|
|
|
|
|
|
7 |
| | | | | |
|
|
|
|
|
|
|
8 |
| | | | | |
|
|
|
|
|
|
|
9 |
| | | | | |
|
|
|
|
|
|
|
0 |
| | | | | |
|
|
|
Each ``word'' in the postal bar-code has 12 digits,
each digit being represented by short bars (we regard as a 0)
and longer bars (which are regarded as a

), as above.
The 12 digits are
interpreted as follows: The first 5 digits are
your zip code, the next 4 digits are the extended zip code,
the next 2 digits are the delivery point digits, and the last
digit is a check digit (all the digits must add to
0 mod

).
For example, suppose that after translating the bars into
digits, you found that the postal code on an envelope was

, where

indicates a digit which was
smudged so you couldn't read it. Since the sum must be
0 mod

, we must have

.
Definition 3.4.5
The
weight distribution vector of a code

is the vector
where

denote the number of codewords in

of
weight

. Note that for an linear code

,

, since any vector space must contain the
zero vector.
Example 3.4.6
In Example
3.3.2, the code

has weight distribution vector

.
Let
be a code. The number
where the minimum runs over all distinct code words in
, is called the minimum distance of
.
This (as we will see) measures the ability for the
code to correct errors which might be
introduced in transmission.
Theorem 3.4.7
If

is a linear code and if

denotes the
minimum distance of

then
where the minimum runs over all non-zero code words in

.
In other words, the minimum distance of a linear code is
the length of its shortest non-zero vector.
proof:
Clearly,
. Conversely, suppose
are code words such that
. By (3.1),
, so
.
Definition 3.4.8
We say that

is
-error correcting if
the following property always holds:
given any

whose Hamming distance from some

is

then any

,

,
must satisfy

(in other words, a
codeword at most distance

from

is unique if

has at most

errors).
Remark 3.4.9
This definition means that if you
have sent off a code word

and
know the receiver received a vector

which has

errors or less
(i.e.,

) then
the code word closest to

(in the sense of the Hamming distance) is

. In this case, to decode the received
vector

, all the receiver has to do
to determine

is search

(which is a finite set)
and find a code word

which is as close as
possible to

. This strategy is called
the
nearest neighbor algorithm.
If

is

-error correcting and

has
no more than

errors then

.
If

is ``too large'' (where the definition of ``large''
is a function of the speed of your computer and your
level of patience) then this algorithm is too
slow for practical purposes.
The following theorem of Shannon is fundamental to the
theory of error correcting codes.
Theorem 3.4.10 (fundamental theorem of information theory)
Consider a binary symmetric channel with

.
Let

and

be given.
For all sufficiently large

,
there is a code

with information rate

satisfying

,
such that the nearest neighbor algorithm
decoding has average probability of
incorrect decoding less that

.
Shannon's theorem guarantees us that ``very good'' codes
(in the sense that they are close to being best possible)
exist. They may not be linear and even if they are,
the theorem does not suggest that they are practical
(i.e., ``fast'' encoding and decoding algorithms exist).
However, we shall very briefly discuss in a later
chapter ``low density parity check codes'',
which can be both ``very good'' and practical.
The proof of Shanon's theorem
is not easy and goes beyond the scope of this book.
For a proof and further discussion, see Ash [Ash],
§3.5.
Figure 3.1 graphs the capacity for a binary
code.
Figure 3.1:
The capacity function for binary codes.
|
Subsections
Next: -codes and error correction
Up: Error-correcting codes
Previous: Basic results on codes
  Contents
  Index
David Joyner
2002-08-23