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

# Hamming weight and distance; validate code 100011

Communication Systems · Chapter 8: Error Detection and Correction Coding

- Asked in: 2073 Shrawan (CS II), 3+4 marks
- Video: [Minimum Hamming Distance, Error Detection Capability, and Error Correction Capability Explained](https://www.youtube.com/watch?v=hrc8kXoBdlw) — Engineering Funda
- 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-100011
- Whole chapter: https://www.bctengineer.com/md/semester_6/communication_systems/chapter-8

## Question

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

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

## Answer

#### Hamming weight

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

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

#### Hamming distance

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

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

#### Validating the received vector

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

$$
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 $\mathbf{r}$ are at positions 1, 5, 6, so add columns 1, 5 and 6 of $H$:

| Row | Col 1 | Col 5 | Col 6 | Sum (mod 2) |
|---|---|---|---|---|
| 1 | 1 | 0 | 0 | 1 |
| 2 | 0 | 1 | 0 | 1 |
| 3 | 1 | 0 | 1 | 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 $110$ matches **column 3** of $H$ $(1,1,0)^T$, so the 3rd bit is in error: $\mathbf{e}=001000$.

$$
\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)$, so 101011 is valid. Corrected message (first 3 bits): **101**.

## Check yourself

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

1. For c1 = 101011 and c2 = 100011, what is the Hamming distance?
   A. 0
   B. 1
   C. 2
   D. 4
   Answer: B. c1 XOR c2 = 001000, which has weight 1, so d = 1. (Key point: Weight and distance example)

2. For r = 100011, which columns of H are added and what is the syndrome?
   A. Columns 1, 5, 6 giving 110
   B. Columns 1, 5, 6 giving 000
   C. Columns 2, 3, 4 giving 110
   D. Columns 1, 3 giving 101
   Answer: A. The 1s are at positions 1, 5, 6; their columns sum to (1,1,0) mod 2. (Key point: Syndrome computation)

3. What does the syndrome 110 tell us about r?
   A. r is a valid codeword
   B. r has no message bits
   C. r is a valid codeword with weight 3
   D. r contains an error because the syndrome is nonzero
   Answer: D. A valid codeword must give the zero syndrome; nonzero means error. (Key point: Validity decision)

4. How is the single-bit error located and what is the corrected word?
   A. Syndrome matches column 5, so flip bit 5 giving 100001
   B. Syndrome matches column 1, so flip bit 1 giving 000011
   C. Syndrome matches column 3 of H, so flip bit 3 giving 101011
   D. Syndrome matches column 6, so flip bit 6 giving 100010
   Answer: C. Syndrome (1,1,0) equals column 3, so e = 001000 and c = 100011 XOR 001000 = 101011; message 101. (Key point: Locating and correcting)

## Related in Communication Systems

- [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 distance and weight; (6,3) code check for 100101](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Ahamming-6-3-h-100101) — Communication Systems, chapter 8
- [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
- [Define Hamming weight and Hamming distance](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Adefine-hamming-weight-distance) — Communication Systems, chapter 8

## Related in other subjects

- [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
- [Construct a (7,4) Hamming code](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Ahamming-74-construct) — 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
