Skip to main content

Hamming weight and distance; (7,4) cyclic code for 1011

Short answer

Hamming weight is the number of 1s in a vector; Hamming distance is the number of differing positions between two vectors. For data 1011, non-systematic codeword is 1111111; systematic codeword is 1011100 (parity 100).

Define Hamming Weight and Hamming Distance. Construct a (7, 4) cyclic code using a generator polynomial g(x) = x³ + x² + 1 with data vector 1011.

Hamming weight

The Hamming weight w(c)w(\mathbf{c}) of a code vector is the number of non-zero (1) elements in it.

Example: w(1011100)=4w(1011100)=4, w(0000000)=0w(0000000)=0.

Hamming distance

The Hamming distance d(c1,c2)d(\mathbf{c}_1,\mathbf{c}_2) between two code vectors of equal length is the number of positions in which they differ. It equals the weight of their modulo-2 sum: d(c1,c2)=w(c1⊕c2)d(\mathbf{c}_1,\mathbf{c}_2)=w(\mathbf{c}_1\oplus\mathbf{c}_2).

Example: c1=1011100\mathbf{c}_1=1011100, c2=1111111\mathbf{c}_2=1111111; c1⊕c2=0100011\mathbf{c}_1\oplus\mathbf{c}_2=0100011, so d=3d=3.

The smallest distance between any two codewords is the minimum distance dmind_{min}; for a linear code it equals the smallest non-zero weight. A code detects up to dmin−1d_{min}-1 errors and corrects up to ⌊(dmin−1)/2⌋\lfloor (d_{min}-1)/2\rfloor. For the (7,4) cyclic Hamming code dmin=3d_{min}=3: it detects 2 and corrects 1 error.

(7,4) cyclic code for data 1011

Given g(x)=x3+x2+1g(x)=x^3+x^2+1, n−k=3n-k=3. Convention: leftmost bit = highest power, so d(x)=x3+x+1d(x)=x^3+x+1. Modulo-2 arithmetic.

Non-systematic form: c(x)=d(x)g(x)c(x)=d(x)g(x)

c(x)=(x3+x+1)(x3+x2+1)=x6+x5+x3  +  x4+x3+x  +  x3+x2+1=x6+x5+x4+x3+x2+x+1\begin{aligned} c(x)&=(x^3+x+1)(x^3+x^2+1)\\ &=x^6+x^5+x^3\;+\;x^4+x^3+x\;+\;x^3+x^2+1\\ &=x^6+x^5+x^4+x^3+x^2+x+1 \end{aligned}

Non-systematic code vector: 1111111.

Systematic form:

  1. x3d(x)=x6+x4+x3x^3d(x)=x^6+x^4+x^3
  2. Divide by g(x)g(x):
              x^3 + x^2
          -------------------------
x^3+x^2+1 ) x^6 +     x^4 + x^3
            x^6 + x^5 +       x^3
            -----------------------
                  x^5 + x^4
                  x^5 + x^4 +       x^2
                  -------------------
                                    x^2
  1. Remainder p(x)=x2p(x)=x^2, parity bits =100= 100.
  2. c(x)=x6+x4+x3+x2c(x)=x^6+x^4+x^3+x^2.

Systematic code vector: 1011 100 (message, then parity).

Check: c(x)=(x3+x2)g(x)c(x)=(x^3+x^2)g(x), so c(x)c(x) is divisible by g(x)g(x) and is a valid codeword.

FormCode vectorWeight
Non-systematic11111117
Systematic10111004

✓ Answer checked by Claude Opus 5.5 (high effort)

All Communication Systems chapter 8 questions →