Open In App

Minimum Hamming Distance

Last Updated : 27 Dec, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Minimum Hamming Distance is the shortest hamming distance between any two codewords. It is also the measure of comparing and correcting two binary codes or data strings in the information theory and computer networks. It is used in linear block coding in information theory for error detection. For a better understanding of minimum hamming distance, first understand its basic terminologies: hamming weight and hamming distance.

Hamming Weight

Define: The Hamming weight of a codeword is equal to the number of non-zero elements in the codeword. Hamming weight of a codeword c is denoted by w(c). It refers to the number of 1’s in a binary code.

E.g.: consider a code C= {0100, 1111}, it has two codewords: 0100 and 1111. Hamming weight of these codewords is w(0100)=1 and w(1111)=4. Here, w(0100) has a hamming weight of 1 because it has one non-zero element (0100) in its codeword. Similarly, w(1111) has a hamming weight of 4 as it has four non-zero elements (1111) in it.

Hamming Distance

Define: Hamming distance between two codewords is the number of places by which the codewords differ. For two codes c1 and c2, the hamming distance is denoted as d(c1 ,c2).

It is the number of positions at which corresponding symbols of two equal length strings are different. It is named after Richard Hamming, an American mathematician and computer engineer.

E.g.: considering codewords c1=0100 and c2=1111, the hamming distance between the two codewords is 3 because they differ at the 1st, 3rd and 4th places in the code.

Logically, the hamming distance can be expressed as the XOR operation of two codewords and result gives the no. of digits by which the codeword differs.

E.g.: c1 ⊕ c2 ⇒ 0100 ⊕ 1111 ⇒ 1011. The XOR operator gives result 3 as there are three 1s obtained after XORing of 0s and 1s.

Minimum Hamming Distance

Define: For two codewords of same length, it is define as the minimum or smallest hamming distance between the two codewords. It is calculated by counting the number of positions in which the corresponding symbols are different. It is denoted by d* or dmin.

E.g.: consider four codewords as: c1=010, c2=011, c3=111, c4=101. The hamming distance between codewords is:

010 ⊕ 011 = 001, d(010, 011) = 1

010 ⊕ 111 = 101, d(010, 111) = 2

010 ⊕ 101 = 111, d(010, 101) = 3

011 ⊕ 111 = 100, d(011, 111) = 1

011 ⊕ 101 = 110, d(011, 101) = 2

111 ⊕ 101 = 010, d(111, 101) = 1;

Therefore the minimum hamming distance is dmin = 1, as from all hamming distances smallest value is 1.

Frequently Asked Questions

Q.1: What is Minimum Hamming Distance and how is it calculated?

Answer:

It is the minimum or least hamming distance between any two codewords. It is measured for codewords of same length (same no. of digits). It is calculated by counting the number of positions in which the corresponding symbols are different. For example, if we have four codewords: 010, 011, 111, 101, the minimum Hamming distance is 1, as from all Hamming distances the smallest is 1.

Q.2: What is significance of Minimum Hamming Distance?

Answer:

It is used in error detection and correction in data transmission.

  • Smaller the Minimum Hamming Distance, fewer the errors it can detect and correct.
  • It is used in linear block coding for error detection.

Q.3: What is the role of Hamming Weight in calculating Hamming Distance?

Answer:

Hamming Weight is the count of non-zero elements in a codeword. While it doesn’t directly contribute to the calculation of Hamming Distance, understanding Hamming Weight is important to understand the concept of Hamming Distance. Hamming Weight deals with the number of non-zero elements in a single codeword, while Hamming Distance deals with the number of differing elements between two codewords.

Q.4: Can Hamming Distance be used for strings of different lengths?

Answer:

No, Hamming Distance is defined only for strings of equal length. It is the count of positions at which the corresponding symbols are different, so both strings should be of equal length.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads