Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm currently learning how Hamming codes work and so far I am understanding it!

I have worked through several examples, and it seems to work well following the below table:Hamming Code Table

Where I get stuck however is when I have an example which its length means it ends on a parity bit. For example:


Ignore the meaning of obviously random binary string above, but the fact that it is 16 bits long, when you are error checking it, you start with p1 and then do p2, p4, p8 and finally p16. What I don't understand however, is that as there are no digits after position 16, how am I meant to work out if p16 is correct or not. If the string was 20 bits long, I know you just count 16 and skip 16, starting at p16. However as there are no bits after p16 I am a bit stuck.

If anyone has any idea, that would be awesome!


share|improve this question
This code has 15 bits of data, plus 5 of redundacy (parity), giving a total of 20 bits per encoded symbol. To decode each symbol you need 20 bits. I don't understand why you are given 16 bits to decode, and what are you supposed to do with that. –  leonbloy Apr 9 '13 at 14:17
The table above shows how to error correct up to 20 bits, but the symbol doesn't have to be 20 bits. For example the code word 110110001010 without the parity bits would be 01001010. The original code word can be error corrected using p1, p2, p4 and p8. My problem is not knowing how to error correct a symbol of 16 bits. –  Luke Presland Apr 9 '13 at 14:36
No. The table above is general, in the sense that it can be used to generate a coding scheme for different sizes. But you must fix that size (raw data size and encoded size) beforehand, and the decoder must know it. –  leonbloy Apr 9 '13 at 14:41
Indeed. The example I am stuck on is a fixed length of 16 bits. I'm not sure if I'm just not explaining this correctly, but I have worked through examples of 12 bits, which I understand. But 16 bits is just confusing. –  Luke Presland Apr 9 '13 at 14:46
add comment

1 Answer

up vote 3 down vote accepted

If the encoded size is 16, this means that the raw size was 11, and the last bit is a useless parity bit, with value zero, that only checks itself. If it's zero, then it's ok, if it's 1 its an error. Of course, to chose this Hamming code of length 16 would be a stupid thing to do, because we are sending a bit with no useful information or error detection capability.

share|improve this answer
Thanks for your answer! When you say 1 means it is an error. Is this effecting the data stream or does it have no effect? –  Luke Presland Apr 9 '13 at 15:05
The error affected only the parity bit, so "the correction" for the data is trivial: do nothing. –  leonbloy Apr 9 '13 at 15:09
Ah thank you. I hope my question wasn't too trivial. –  Luke Presland Apr 9 '13 at 15:14
Not, it wasn't. –  leonbloy Apr 9 '13 at 15:16
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.