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.

Note that

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**proof**: Let

*For example, and are code words. Their Hamming distance is .*

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 .*

David Joyner 2007-09-03