Skip to main content

Hamming distance and weight; (6,3) code check for 100101

Short answer

Hamming weight is the number of 1s in a vector; Hamming distance is the number of differing positions between two vectors. The syndrome for 100101 is (000), so it is a valid codeword without error.

Define hamming distance and hamming weight. For a (6,3) code, the parity check matrix is given by H = [1 0 1 _ 0 0; 0 1 1 _ 1 0; 1 1 0 _ 0 1] (as printed, one column of H is blank; it is most likely H = [1 0 1 1 0 0; 0 1 1 0 1 0; 1 1 0 0 0 1]). Determine whether a received code vector 100101 is erroneous.

Hamming weight

The Hamming weight of a code vector is the number of 1s in it. Example: w(100101)=3w(100101)=3.

Hamming distance

The Hamming distance between two vectors is the number of positions where they differ, d(x,y)=w(x⊕y)d(\mathbf{x},\mathbf{y})=w(\mathbf{x}\oplus\mathbf{y}). Example: d(100101,101011)=w(001110)=3d(100101,101011)=w(001110)=3.

Checking the received vector

The printed HH has a blank column; it is taken as the standard systematic form H=[PT∣I3]H=[P^T\mid I_3]:

H=[101100011010110001]H=\begin{bmatrix}1&0&1&1&0&0\\0&1&1&0&1&0\\1&1&0&0&0&1\end{bmatrix}

A received vector r\mathbf{r} is error-free (a valid codeword) if its syndrome s=rHT\mathbf{s}=\mathbf{r}H^T is zero.

r=(1 0 0 1 0 1)\mathbf{r}=(1\,0\,0\,1\,0\,1): the 1s are in positions 1, 4 and 6, so s\mathbf{s} is the mod-2 sum of columns 1, 4 and 6 of HH:

RowCol 1Col 4Col 6Sum
11100
20000
31010
s=rHT=(0 0 0)\mathbf{s}=\mathbf{r}H^T=(0\ 0\ 0)

The syndrome is zero, so 100101 is a valid codeword (not erroneous), assuming no undetectable error pattern.

Check with the generator matrix G=[I3∣P]G=[I_3\mid P]:

G=[100101010011001110]G=\begin{bmatrix}1&0&0&1&0&1\\0&1&0&0&1&1\\0&0&1&1&1&0\end{bmatrix}

Message 100 gives c=100 101\mathbf{c}=100\,101, exactly the received vector. Message = 100.

(If a syndrome were non-zero, matching it to a column of HH would locate a single-bit error; this code has dmin=3d_{min}=3.)

✓ Answer checked by Claude Opus 5.5 (high effort)

All Communication Systems chapter 8 questions →