[Math] Decoding and correcting $(1,0,0,1,0,0,1)$ Hamming$ (7,4)$ code

coding-theory

Correct any error and decode $(1,0,0,1,0,0,1)$ encoded using Hamming $(7,4)$ assuming at most one error. The message $(a,b,c,d)$ is encoded $(x,y,a,z,b,c,d)$

The solution states $H_m = (0,1,0)^T$ which corresponds to the second column in the Standard Hamming (7,4) matrix which means the second digit, 0, is wrong and the corrected code is $(1,1,0,1,0,0,1)$. The resulting code becomes $(0,0,0,1)$

My question is: How do I get $H_m$?

Best Answer

The short answer is that you get the syndrome $H_m$ by multiplying the received vector $r$ with the parity check matrix: $H_m=H r^T$.

There are several equivalent parity check matrices for this Hamming code, and you haven't shown us which is the one your source uses. The bits that you did give hint at the possibility that the check matrix could be $$ H=\pmatrix{1&0&1&0&1&0&1\cr0&1&1&0&0&1&1\cr0&0&0&1&1&1&1\cr}. $$ To be fair, that is one of the more popular choices, and also fits your received word / syndrome pair :-). The reason I'm nitpicking about this is that any one of the $7!=5040$ permutations of the columns would work equally well for encoding/decoding. Being an algebraist at heart, I often prefer an ordering that exhibits the cyclic nature of the code better. Somebody else might insist on an ordering the matches with systematic encoding. Doesn't matter much!

Here your received vector $r=(1,0,0,1,0,0,1)$ has bits on at positions 1, 4 and 7, so the syndrome you get is $$ H_m=H r^T=\pmatrix{1\cr 0\cr0\cr}+\pmatrix{0\cr 0\cr1\cr}+\pmatrix{1\cr 1\cr1\cr}=\pmatrix{0\cr 1\cr0\cr} $$ the modulo two sum of the first, fourth and seventh columns of $H$.

If $r$ were a valid encoded message, then the syndrome $H_m$ would be the zero vector. As that was not the case here, an error (one or more) has occurred. The task of the decoder is to find the most likely error, and the usual assumptions lead us to the goal of toggling as few bits of $r$ as possible.

The nice thing about the Hamming code is that we can always do this by toggling at most one bit. We identify $H_m$ as the second column of $H$, so to make the syndrome zero by correcting a single bit we need to toggle the second bit of $r$.

What makes the Hamming code tick is that all possible non-zero syndrome vectors occur as columns of $H$. Therefore we always meet our goal of making the syndrom zero by toggling (at most) a single bit of any received word.

Related Question