Explain hamming distance satisfies the triangle inequity

In summary, Hamming distance satisfies the triangle inequality for all x, y, u in c such that d(x,y) <= d(x,u) + d(u,y) where c is a code. The equality holds when changing x to y, z is just an intermediate step, the equality holds. However, this approach may only work for binary alphabets.
  • #1
Askhwhelp
86
0
Hamming distance satisfies the triangle inequity that is for all x, y, u in c such that d(x,y) <= d(x,u) + d(u,y) where c is a code. Also when does the equality hold?

My approach is
Turning x to u by changing at most d(x,u) letters and turning u to y by changing at most d(u,y) letters. So turning x to t will change no more than d(x,u) + d(u,y) letters.


By looking at the following example, x = 001111, y = 111111, z = 011111. The equality holds when changing x to y, z is just a intermediate step, the equality holds.

Does this make sense?

If not, how should I approach this?
 
Last edited:
Physics news on Phys.org
  • #2
Askhwhelp said:
Hamming distance satisfies the triangle inequity that is for all x, y, u in c such that d(x,y) <= d(x,u) + d(u,y) where c is a code. Also when does the equality hold?

My approach is
Turning x to u by changing at most d(x,u) letters and turning u to y by changing at most d(u,y) letters. So turning x to t will change no more than d(x,u) + d(u,y) letters.

By looking at the following example, x = 001111, y = 111111, z = 011111. The equality holds when changing x to y, z is just a intermediate step, the equality holds.
You have the right idea, but you might state it more precisely. If we define ##x_n##, ##y_n##, and ##u_n## to be the ##n##'th letter of ##x##, ##y##, and ##u##, respectively, and ##N## is the code length, then we have
$$d(x,y) = \sum_{n=1}^{N} |x_n - y_n|$$
and similarly for ##d(y,u)## and ##d(x,u)##. Proving the triangle inequality is therefore equivalent to proving that
$$\sum_{n=1}^{N} |x_n -y_n| \leq \sum_{n=1}^{N} |x_n - u_n| + \sum_{n=1}^{N} |u_n - y_n|$$
 
  • #3
jbunniii said:
You have the right idea, but you might state it more precisely. If we define ##x_n##, ##y_n##, and ##u_n## to be the ##n##'th letter of ##x##, ##y##, and ##u##, respectively, and ##N## is the code length, then we have
$$d(x,y) = \sum_{n=1}^{N} |x_n - y_n|$$
and similarly for ##d(y,u)## and ##d(x,u)##. Proving the triangle inequality is therefore equivalent to proving that
$$\sum_{n=1}^{N} |x_n -y_n| \leq \sum_{n=1}^{N} |x_n - u_n| + \sum_{n=1}^{N} |u_n - y_n|$$
I like the approach, though this only works if we are considering binary alphabets. The hamming distance can be used on alphabets such as {1,2,3} in which case $$d(x,y) = \sum_{n=1}^{N} |x_n - y_n|$$, does not hold
 

1. What is the definition of Hamming distance?

The Hamming distance is a measure of the number of positions at which two strings of equal length differ. It is used to compare two binary strings and is calculated by counting the number of positions where the bits are different.

2. How does the triangle inequality apply to Hamming distance?

The triangle inequality states that the sum of any two sides of a triangle must be greater than the length of the third side. In terms of Hamming distance, this means that the distance between two strings must always be less than or equal to the sum of their individual distances from a third string.

3. Why is it important for Hamming distance to satisfy the triangle inequality?

The triangle inequality is important for Hamming distance because it ensures that the distance measurement is consistent and follows a logical order. If the triangle inequality is not satisfied, it could lead to contradictory distance measurements and make it difficult to compare strings accurately.

4. Can you provide an example of how Hamming distance satisfies the triangle inequality?

Let's say we have three strings: ABC, DEF, and GHI. The Hamming distance between ABC and DEF is 2, because only two letters are different. The Hamming distance between DEF and GHI is also 2. If we add these two distances together (2+2), we get 4. Now, the Hamming distance between ABC and GHI is 4, because all three letters are different. Since 4 is equal to the sum of the individual distances (2+2), the triangle inequality is satisfied.

5. How is the concept of Hamming distance used in real life applications?

Hamming distance is commonly used in fields such as coding theory, computer science, and genetics. In coding theory, it is used to measure the error-correcting capabilities of codes. In computer science, it is used for data compression and error detection. In genetics, it is used to compare DNA sequences and identify similarities and differences between different organisms.

Similar threads

  • Calculus and Beyond Homework Help
Replies
8
Views
2K
  • Calculus and Beyond Homework Help
Replies
9
Views
1K
  • Calculus and Beyond Homework Help
Replies
19
Views
1K
  • Calculus and Beyond Homework Help
Replies
8
Views
474
  • Calculus and Beyond Homework Help
Replies
9
Views
2K
  • Calculus and Beyond Homework Help
Replies
3
Views
2K
  • Calculus and Beyond Homework Help
Replies
1
Views
2K
Replies
45
Views
2K
  • Calculus and Beyond Homework Help
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
20
Views
3K
Back
Top