---
title: "Hamming distance and minimum distance"
subject: "Data Communication"
chapter: 8
key: "semester_5/data_communication:hamming-distance-define"
source: https://www.bctengineer.com/q/semester_5/data_communication/hamming-distance-define
site: BCT Engineering
---

# Hamming distance and minimum distance

Data Communication · Chapter 8: Information Theory and Coding

- Asked in: 2072 Kartik, 4 marks; 2071 Shrawan, 2 marks (asked 2 times)
- Video: [Error Correcting Codes: What is Hamming Distance and Minimum Hamming Distance ?](https://www.youtube.com/watch?v=7SVSXiWc0-o) — ALL ABOUT ELECTRONICS
- Answer checked by Claude Sonnet 5.5 on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/data_communication/hamming-distance-define
- Whole chapter: https://www.bctengineer.com/md/semester_5/data_communication/chapter-8

## Question

Define Hamming distance and minimum Hamming distance with suitable example.

## Short answer

Hamming distance between two binary words is the number of differing bits. The minimum distance d_min of a code is the smallest such distance between any two distinct codewords. For the code {00000,01011,10101,11110}, d_min=3, so it detects up to 2 errors and corrects 1.

## Answer

#### Hamming distance
The **Hamming distance** d(x, y) between two binary words of equal length is the number of bit positions in which they differ. It equals the weight of x ⊕ y.

Example: x = 10110, y = 11100 → x ⊕ y = 01010 → d(x, y) = **2**.

#### Minimum Hamming distance
The **minimum distance d_min** of a code is the smallest Hamming distance between any two different codewords.

Example: code {00000, 01011, 10101, 11110}
- d(00000, 01011) = 3
- d(00000, 10101) = 3
- d(00000, 11110) = 4
- d(01011, 10101) = 4
- d(01011, 11110) = 3
- d(10101, 11110) = 3

d_min = **3**.

#### Significance
- Detects up to d_min − 1 errors.
- Corrects up to t = ⌊(d_min − 1)/2⌋ errors. Here it detects 2 and corrects 1.
- For a linear code, d_min equals the minimum non-zero codeword weight.

## Check yourself

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

1. What is the Hamming distance between 10110 and 11100?
   A. 1
   B. 2
   C. 3
   D. 4
   Answer: B. XOR gives 01010, which has two 1s, so d = 2. (Key point: Hamming distance)

2. What is the minimum Hamming distance of a code?
   A. The largest distance between any two codewords
   B. The distance between all-zero and all-one words
   C. The smallest distance between any two different codewords
   D. The number of parity bits
   Answer: C. d_min is the smallest pairwise distance between distinct codewords. (Key point: Minimum distance)

3. A code has d_min = 3. How many errors can it detect and correct?
   A. Detect 2, correct 1
   B. Detect 3, correct 1
   C. Detect 1, correct 2
   D. Detect 3, correct 3
   Answer: A. It detects d_min - 1 = 2 errors and corrects floor((d_min - 1)/2) = 1 error. (Key point: Detection and correction capability)

## Related in Data Communication

- [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
- [Redundancy, Hamming distance, linear vs cyclic](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Aredundancy-hamming-linear-cyclic) — Data Communication, chapter 8

## Related in other subjects

- [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 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 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
