Skip to main content

Hamming weight/distance; validate x = 0111000 with given H

Short answer

Hamming weight of x=(0111000) is 3. Hamming distance from all-zero is 3. Validity: syndrome s = H x^T = sum of columns 2,3,4 of H = (0,0,0)^T, so x is a valid codeword.

Define Hamming weight and Hamming distance for a code vector x = (0111000) and the parity check matrix H given below. Prove that, the given code is valid. H = [1 1 1 0 1 0 0; 1 1 0 1 0 1 1; 1 0 1 1 0 0 1] (3×7)

Hamming weight

The Hamming weight w(x)w(\mathbf{x}) of a code vector is the number of 1s in it. For x=(0111000)\mathbf{x}=(0111000):

w(x)=0+1+1+1+0+0+0=3w(\mathbf{x})=0+1+1+1+0+0+0=3

Hamming distance

The Hamming distance between two code vectors is the number of positions in which they differ, d(x,y)=w(x⊕y)d(\mathbf{x},\mathbf{y})=w(\mathbf{x}\oplus\mathbf{y}). For example, distance of x\mathbf{x} from the all-zero codeword is d(0111000,0000000)=3d(0111000,0000000)=3, and from y=1111111\mathbf{y}=1111111 it is w(1000111)=4w(1000111)=4.

Proof that x is a valid codeword

A vector is a valid codeword of the code if and only if its syndrome is zero:

s=HxT=0(equivalently xHT=0)\mathbf{s}=H\mathbf{x}^T=\mathbf{0}\quad(\text{equivalently } \mathbf{x}H^T=\mathbf{0}) H=[111010011010111011001],xT=[0111000]H=\begin{bmatrix}1&1&1&0&1&0&0\\1&1&0&1&0&1&1\\1&0&1&1&0&0&1\end{bmatrix},\qquad \mathbf{x}^T=\begin{bmatrix}0\\1\\1\\1\\0\\0\\0\end{bmatrix}

Only positions 2, 3 and 4 of x\mathbf{x} are 1, so HxTH\mathbf{x}^T is the modulo-2 sum of columns 2, 3 and 4 of HH:

RowCol 2Col 3Col 4Sum (mod 2)
11101+1+0=01+1+0=0
21011+0+1=01+0+1=0
30110+1+1=00+1+1=0
s=HxT=[000]\mathbf{s}=H\mathbf{x}^T=\begin{bmatrix}0\\0\\0\end{bmatrix}

Since the syndrome is the zero vector, x=(0111000)\mathbf{x}=(0111000) satisfies all three parity-check equations. Hence the given code vector is valid.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Communication Systems chapter 8 questions →