I'm reading a book on Error Correcting Codes, It introduces the concept of Hamming's Distance:
Given two elements $u,v\in A^n$ for some natural number $n$.
$d(u,v)=|\{i;u_i\neq v_i,1\leq i \leq n\}|$
For example in $\{0,1\}^3$ we have;
1) $ d(001,111)=2$
2) $d(000,111)=3$
3) $d(100,110)=1$
With the examples, I understand that it seems to be about the number of spins that is needed for one number to become another, in the first example, we just need to spin the zeroes, so it becomes $111$. My problem the following: Is it really possible to understand this with that definition alone? I've read it a lot of times - ignoring I knew the definition given by the example, I tried to search for the meaning of it in the definition.
My first interpretation: I've read $d(u,v)=|\{i;u_i\neq v_i,1\leq i \leq n\}|$ like this: The distance between $u$ and $v$ is $i$ - and I'm thinking that $i$ is the index of all numbers of $A^n$, so using the example I mentioned before:
$$\begin{matrix} {i}&{}&{}&{}\\ {1}&{0}&{0}&{0}\\ {2}&{0}&{0}&{1}\\ {3}&{0}&{1}&{0}\\ {4}&{0}&{1}&{1}\\ {5}&{1}&{0}&{0}\\ {6}&{1}&{0}&{1}\\ {7}&{1}&{1}&{0}\\ {8}&{1}&{1}&{1} \end{matrix}$$
Then it would be the distance between $i=8$ and $i=2$, but there's a symmetry [$d(u,v)=d(v,u)$] property on the operation, going from $8$ to $2$ would require two jumps, going from $2$ to $8$ would require $6$ jumps. I guess this would make this interpretation plainly wrong, unless perhaps we consider only the minimal distance from both (I guess it's viable, but I still have no proof that it would work - although I feel that it's obvious it would work).
My second interpretation:I've also thought about the number of changes needed for going from one number to the other in the following form: Again, using the first example for going from $001$ to $111$, we need to compare both and ignore the equal part on them, for example:
$$001+111\rightarrow 00\color{red}{1}+11\color{red}{1}\rightarrow 00+X=11$$
And then discover that the sum needed to find $X$ can be found inside $A^2$ which have the following elements: $\{00,01,10,11\}$.
My problem is that the first interpretation seems more close to the definition and also a little incorrect, and the second one seems to be correct but less closer.
- Bonus Question: My book calls the aforementioned concept of Métrica de Hamming which could be translated (roughly, I suppose) to Hamming's Metric - Is there a problem of using Hamming's Metric instead of Hamming's Distance? I'm confused because I guess this could conflict with the meaning of something in measure theory.
The Hamming distance, or the Hamming metric (means the exact same thing) is the number of bit flips required to change one string $n$ binary bits to another string of $n$ binary bits. In more detail, assuming some fixed value of $n$, strings of $n$ binary bits can be modeled as functions $f:\{1,2,\cdots, n\}\to \{0,1\}$. Then, given two such strings given by $f,g$, then $S=\{1\le i\le n\mid f(i)\ne g(i)\}$ is the set of indices where $f$ and $g$ differ. Then, $d(f,g)=|S|$ is the number of differing bits, and is, by definition, the Hamming distance. It is easy to show that it turns the set of all $n$-length binary strings into a metric space.