PlanetMath (more info)
 Math for the people, by the people. Sponsor PlanetMath
Encyclopedia | Requests | Forums | Docs | Wiki | Random | RSS  
Login
create new user
name:
pass:
forget your password?
Main Menu
Owner confidence rating: High Entry average rating: No information on entry rating
Hamming metric (Definition)

Let

$\displaystyle x$ $\displaystyle = (x_1,x_2,x_3,\ldots,x_n),$    
$\displaystyle y$ $\displaystyle = (y_1,y_2,y_3,\ldots,y_n)$    

be bit patterns, that is, vectors consisting of zeros and ones.

The Hamming distance $d_H(u,v)$ defined as$$ \sum_{j=1}^n |x_i-y_i|$$ is equal to the number of positions where the bit patterns are differents.

For instance, if $u =(0,1,1,0,1,0,1)$ and $v =(1,0,1,0,1,0,1)$ then$$ d_H(u,v) = |0-1|+ |1-0| + |1-1| + |0-0|+|1-1| + |0-0| + |1-1| = 3$$ because $u$ and $v$ have different bits at three positions.

The Hamming distance holds the properties of a metric (otherwise it would not be truly a distance):

  • $d_H(x,y)\geq 0$ for any $x,y$ .
  • $d_H(x,y)=0$ if and only if $x=y$ .
  • $d_H(x,y) = d_H(y,x)$ for any $x,y$ .
  • $d_H(x,y)\leq d_H(x,z) + d_H(z,y)$ for any $x,y,z$ .

If we realize that $d_H$ is counting something (positions where bits differ), then it's clear that $d_H$ can never be negative. Also, $d_H(x,x)= 0$ because a bit pattern has no different bits respect to itself, and if two bit patterns coincide on each position, they are indeed the same pattern, which proves the second property. The third condition also follows from the trivial fact that if $x$ differs at some position from $y$ , then $y$ differs at the sae position from $x$ .

We are left to prove the last condition (trangle inequality). If

$\displaystyle x$ $\displaystyle = (x_1,x_2,x_3,\ldots,x_n)$    
$\displaystyle y$ $\displaystyle = (y_1,y_2,y_3,\ldots,y_n)$    
$\displaystyle z$ $\displaystyle = (z_1,z_2,z_3,\ldots,z_n)$    

then $d_H(x,y)$ counts at how many places does $x$ differ from $y$ . For instance, suppose that $x_3\neq y_3$ . This means that the third bits are different, which adds $1$ to the whole sum $d_H(x,y)$ .

Now, if $x_3\neq y_3$ it cannot happen that $x_3=z_3$ and $z_3=y_3$ at the same time, so we have that $x_3\neq z_3$ or $z_3\neq y_3$ . In either case, the sum $d_H(x,z) + d_H(z,y)$ also increases by one.

So, for each mismatch that increases $d_H(x,y)$ by one, $d_H(x,z)+ d_H(z,y)$ also increases by one. We conclude that$$ d_H(x,y)\leq d_H(x,z) + d_H(z,y).$$




"Hamming metric" is owned by drini. [ full author list (2) | owner history (1) ]
(view preamble | get metadata)

View style:

See Also: Hamming distance

Other names:  Hamming distance, Hamming metric
Log in to rate this entry.
(view current ratings)

Cross-references: sum, places, inequality, negative, clear, distance, metric, properties, number, vectors
There are 2 references to this entry.

This is version 4 of Hamming metric, born on 2005-02-01, modified 2005-02-01.
Object id is 6699, canonical name is HammingMetric.
Accessed 6341 times total.

Classification:
AMS MSC05C12 (Combinatorics :: Graph theory :: Distance in graphs)
 94C99 (Information and communication, circuits :: Circuits, networks :: Miscellaneous)

Pending Errata and Addenda
None.
Discussion
Style: Expand: Order:
forum policy

No messages.

Interact
post | correct | update request | add derivation | add example | add (any)