Skip to main content

Hamming weight and distance; validate code 100011

Short answer

Hamming weight: number of 1s (e.g., 100011 has weight 3). Hamming distance: number of differing positions. Syndrome is (110), matching column 3 of H, so bit 3 is erroneous; corrected codeword is 101011, message 101.

Define Hamming weight and Hamming distance with examples. Validate the code if received code vector code is [100011] given that H = [1 0 1 1 0 0; 0 1 1 0 1 0; 1 1 0 0 0 1].

Hamming weight

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

Example: w(101011)=4w(101011)=4, w(100011)=3w(100011)=3.

Hamming distance

The Hamming distance d(c1,c2)d(\mathbf{c}_1,\mathbf{c}_2) is the number of positions in which two code vectors differ, d=w(c1⊕c2)d=w(\mathbf{c}_1\oplus\mathbf{c}_2).

Example: c1=101011\mathbf{c}_1=101011, c2=100011\mathbf{c}_2=100011, c1⊕c2=001000\mathbf{c}_1\oplus\mathbf{c}_2=001000, so d=1d=1.

Validating the received vector

A received vector is a valid codeword only if the syndrome s=rHT=0\mathbf{s}=\mathbf{r}H^T=\mathbf{0}.

H=[101100011010110001],r=(1 0 0 0 1 1)H=\begin{bmatrix}1&0&1&1&0&0\\0&1&1&0&1&0\\1&1&0&0&0&1\end{bmatrix},\qquad \mathbf{r}=(1\,0\,0\,0\,1\,1)

The 1s of r\mathbf{r} are at positions 1, 5, 6, so add columns 1, 5 and 6 of HH:

RowCol 1Col 5Col 6Sum (mod 2)
11001
20101
31010
s=(1 1 0)≠0\mathbf{s}=(1\ 1\ 0)\neq\mathbf{0}

The received vector 100011 is not a valid codeword; it contains an error.

Correction (single error)

The syndrome 110110 matches column 3 of HH (1,1,0)T(1,1,0)^T, so the 3rd bit is in error: e=001000\mathbf{e}=001000.

c^=r⊕e=100011⊕001000=101011\hat{\mathbf{c}}=\mathbf{r}\oplus\mathbf{e}=100011\oplus001000=101011

Check: columns 1, 3, 5, 6 sum to (1+1+0+0, 0+1+1+0, 1+0+0+1)=(0,0,0)(1+1+0+0,\ 0+1+1+0,\ 1+0+0+1)=(0,0,0), so 101011 is valid. Corrected message (first 3 bits): 101.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Communication Systems chapter 8 questions →