Skip to main content

Hamming distance and minimum distance

Short answer

Hamming distance between two binary words is the number of differing bits. The minimum distance d_min of a code is the smallest such distance between any two distinct codewords. For the code {00000,01011,10101,11110}, d_min=3, so it detects up to 2 errors and corrects 1.

Define Hamming distance and minimum Hamming distance with suitable example.

Hamming distance

The Hamming distance d(x, y) between two binary words of equal length is the number of bit positions in which they differ. It equals the weight of x ⊕ y.

Example: x = 10110, y = 11100 → x ⊕ y = 01010 → d(x, y) = 2.

Minimum Hamming distance

The minimum distance d_min of a code is the smallest Hamming distance between any two different codewords.

Example: code {00000, 01011, 10101, 11110}

  • d(00000, 01011) = 3
  • d(00000, 10101) = 3
  • d(00000, 11110) = 4
  • d(01011, 10101) = 4
  • d(01011, 11110) = 3
  • d(10101, 11110) = 3

d_min = 3.

Significance

  • Detects up to d_min − 1 errors.
  • Corrects up to t = ⌊(d_min − 1)/2⌋ errors. Here it detects 2 and corrects 1.
  • For a linear code, d_min equals the minimum non-zero codeword weight.

✓ Answer checked by Claude Sonnet 5.5

All Data Communication chapter 8 questions →