# Hamming code distance and error detection

Suppose that data are transmitted in blocks of sizes 1000 bits. What is the maximum error rate under which error detection and retransmission mechanism (1 parity bit per block) is better than using Hamming code? Assume that bit errors are independent of one another and no bit error occurs during retransmission.

This is one of the questions from Tanenbaum book.

My approach is since there are 1000 data bits so, 2^r > = r+data bits +1

r = 10 and so the number of check bits is 10. So, the length of hamming code is 1010. Till here I am able to solve. But how will I get the error rate for the retransmission error detection technique compared to hamming code.

Can anyone explain how to proceed further ?

Let's see. With parity, each block is 1001 bits long vs 1010 bit for Hamming code. So if the error rate is 0, then you economize 9 bits.

OTOH, if each second block fails, the in 50% of cases you will have to transmit a second block, in 25% of cases third block and so on. On average you have to send 2 blocks.

Now, let's go deeper. If the error rate is r, this means that each bit fails with the r probability. So, you can compute probability that there are k errors in the block.

You know that if there are 0 errors, you don't need to retransmit block, for a single error you need to retransmit parity-protected block, and for 2n errors you will got unrecoverable error.

Similarly, you can compute it for Hamming code protected block.