---
title: "Hamming distance and weight; (6,3) code check for 100101"
subject: "Communication Systems"
chapter: 8
key: "semester_6/communication_systems:hamming-6-3-h-100101"
source: https://www.bctengineer.com/q/semester_6/communication_systems/hamming-6-3-h-100101
site: BCT Engineering
---

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

Communication Systems · Chapter 8: Error Detection and Correction Coding

- Asked in: 2075 Chaitra (CS II), 2+5 marks
- Video: [LINEAR BLOCK CODES in simple way - Find codeword for message and decode the received sequence| hindi](https://www.youtube.com/watch?v=x0eu7gP4r10) — Electronics Subjectified
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/communication_systems/hamming-6-3-h-100101
- Whole chapter: https://www.bctengineer.com/md/semester_6/communication_systems/chapter-8

## Question

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.

## 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.

## Answer

#### Hamming weight

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

#### Hamming distance

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

#### Checking the received vector

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

$$
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 $\mathbf{r}$ is error-free (a valid codeword) if its syndrome $\mathbf{s}=\mathbf{r}H^T$ is zero.

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

| Row | Col 1 | Col 4 | Col 6 | Sum |
|---|---|---|---|---|
| 1 | 1 | 1 | 0 | 0 |
| 2 | 0 | 0 | 0 | 0 |
| 3 | 1 | 0 | 1 | 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=[I_3\mid P]$:

$$
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 $\mathbf{c}=100\,101$, exactly the received vector. Message = **100**.

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

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What do Hamming weight and Hamming distance measure?
   A. Weight: number of 0s in a vector; distance: number of 1s in common
   B. Weight: number of 1s in a vector; distance: number of positions where two vectors differ
   C. Weight: length of the vector; distance: difference of their decimal values
   D. Weight: number of parity bits; distance: number of message bits
   Answer: B. Weight counts the 1s in one vector, and distance counts differing positions, which equals the weight of x XOR y. (Key point: Hamming weight and distance)

2. When is a received vector r declared error-free for parity-check matrix H?
   A. When the syndrome s = rH^T is the zero vector
   B. When r times H^T has a nonzero syndrome
   C. When r has even weight
   D. When r equals the first row of H
   Answer: A. A valid codeword satisfies cH^T = 0, so a zero syndrome means r is a codeword. (Key point: Syndrome test)

3. For r = 100101, how is the syndrome obtained and what is it?
   A. Add columns 2, 3 and 5 of H mod 2, giving 000
   B. Add columns 1, 4 and 6 of H mod 2, giving 110
   C. Add rows 1, 4 and 6 of H, giving 101
   D. Add columns 1, 4 and 6 of H mod 2, giving 000
   Answer: D. The 1s of r are in positions 1, 4, 6; those columns of H sum to (0,0,0) mod 2. (Key point: Computing the syndrome)

4. How does the generator matrix G = [I3 | P] confirm that 100101 is valid?
   A. Message 101 encodes to 100101
   B. The rows of G sum to 111111
   C. Message 100 encodes to 100101, exactly the received vector
   D. G has d_min = 6
   Answer: C. Encoding message 100 picks the first row of G, which is 100101, so the received vector is a valid codeword. (Key point: Cross-check with G)

## Related in Communication Systems

- [(6, 3) code from parity check matrix](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Alinear-block-code-6-3-h-matrix) — Communication Systems, chapter 8
- [Hamming weight and distance; validate code 100011](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Ahamming-6-3-h-100011) — Communication Systems, chapter 8
- [Hamming weight/distance; validate x = 0111000 with given H](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Ahamming-code-vector-0111000) — Communication Systems, chapter 8, asked 2×
- [Hamming weight and distance; (7,4) cyclic code for 1011](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Ahamming-weight-cyclic-1011) — Communication Systems, chapter 8, asked 2×
- [Hamming distance and weight; rate 1/3 convolutional encoder](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Ahamming-third-rate-convolutional) — Communication Systems, chapter 8
- [Hamming distance and weight importance; syndrome decoding](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Ahamming-importance-syndrome-decoding) — Communication Systems, chapter 8

## Related in other subjects

- [Construct a (7,4) Hamming code](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Ahamming-74-construct) — Data Communication, chapter 8
- [Minimum Hamming distance; find k and n](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Amin-hamming-k-n) — Data Communication, chapter 8
- [Forward error correction using Hamming code](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Afec-hamming) — Data Communication, chapter 8
- [Speech characteristics and 7-bit Hamming code](https://www.bctengineer.com/question.md?key=semester_7%2Fwireless_communication%3Aspeech-hamming-code) — Wireless Communication, chapter 6
