Fiveable

🔢Coding Theory Unit 3 Review

QR code for Coding Theory practice questions

3.2 Hamming Distance and Minimum Distance

🔢Coding Theory
Unit 3 Review

3.2 Hamming Distance and Minimum Distance

Written by the Fiveable Content Team • Last updated September 2025
Written by the Fiveable Content Team • Last updated September 2025
🔢Coding Theory
Unit & Topic Study Guides

Linear codes use Hamming distance to measure differences between codewords. This concept is crucial for understanding error detection and correction capabilities. The minimum distance between codewords determines how many errors a code can handle.

Hamming distance and minimum distance are key to designing effective coding schemes. They help balance the trade-off between error control and code efficiency. These concepts are fundamental to creating robust communication systems in the digital age.

Hamming Distance and Minimum Distance

Measuring Differences Between Codewords

  • Hamming distance quantifies the number of positions in which two codewords differ
  • Calculated by comparing each position of the codewords and counting the differences
  • Provides a metric for determining the dissimilarity between codewords
  • Essential for understanding the error detection and correction capabilities of a code

Properties and Applications

  • Minimum distance is the smallest Hamming distance between any two distinct codewords in a code
  • Determines the error detection and correction capabilities of a code
    • Larger minimum distance allows for better error detection and correction
  • Hamming weight is the number of non-zero elements in a codeword
    • Special case of Hamming distance when one codeword is the all-zero codeword
  • Minimum distance is equal to the minimum Hamming weight of any non-zero codeword in a linear code

Examples and Calculations

  • Consider two binary codewords: 1011 and 0111
    • Hamming distance is 1 because they differ in only one position
  • For the code C = {000, 011, 101, 110}, the minimum distance is 2
    • Smallest Hamming distance between any two codewords is 2 (e.g., between 011 and 101)
  • In the code C = {0000, 1111}, the minimum distance is 4
    • Codewords differ in all positions, resulting in a high error correction capability

Error Detection and Correction Capabilities

Relationship with Minimum Distance

  • Error detection capability of a code depends on its minimum distance
    • A code can detect up to $(d_{min} - 1)$ errors, where $d_{min}$ is the minimum distance
  • Error correction capability is determined by the minimum distance
    • A code can correct up to $\lfloor\frac{d_{min} - 1}{2}\rfloor$ errors
  • Increasing the minimum distance improves both error detection and correction capabilities

Trade-offs and Code Rate

  • Code rate measures the efficiency of a code in terms of information transmission
    • Defined as the ratio of the number of information bits to the total number of bits in a codeword
  • Higher error detection and correction capabilities often come at the cost of a lower code rate
    • Adding more redundancy (parity bits) increases the codeword length and reduces the code rate
  • Balancing the code rate and error control capabilities is crucial in designing efficient coding schemes

Examples and Applications

  • Consider a code with a minimum distance of 5
    • It can detect up to 4 errors and correct up to 2 errors
  • Hamming codes are a class of linear codes with a minimum distance of 3
    • They can detect and correct single-bit errors
  • Low-density parity-check (LDPC) codes and turbo codes achieve high error correction performance with reasonable code rates
    • Widely used in modern communication systems (5G, satellite communications)

Bounds and Perfect Codes

Sphere Packing Bound

  • Sphere packing bound provides an upper limit on the number of codewords in a code with a given length and minimum distance
  • Based on the concept of packing non-overlapping spheres in a high-dimensional space
    • Each sphere represents a codeword and its surrounding space that can be corrected
  • Helps determine the maximum possible code size for a given error correction capability

Singleton Bound and Perfect Codes

  • Singleton bound states that for a linear code with length $n$, dimension $k$, and minimum distance $d$, $d \leq n - k + 1$
    • Provides an upper limit on the minimum distance of a code
  • Perfect codes are codes that attain the sphere packing bound with equality
    • They have the maximum possible number of codewords for a given length and minimum distance
  • Examples of perfect codes include the Hamming codes and the Golay codes
    • Hamming codes: Perfect codes with parameters $(2^m - 1, 2^m - m - 1, 3)$, where $m \geq 2$
    • Golay codes: Binary Golay code $(23, 12, 7)$ and ternary Golay code $(11, 6, 5)$

Implications and Applications

  • Bounds provide theoretical limits on the performance of error-correcting codes
    • Help in understanding the fundamental trade-offs between code length, code rate, and error correction capability
  • Perfect codes are optimal in terms of error correction for a given length and code rate
    • However, they are rare and may not always be practical for real-world applications
  • Designing codes that approach the bounds while maintaining practical implementation complexity is an ongoing research area
    • Turbo codes, LDPC codes, and polar codes are examples of high-performance codes that approach the theoretical limits