Suppose we have m data bits and n parity bits. In order for the Hamming code to function: $$m+n<2^n-1$$

If we have 3 parity bits we can have up to 4 data bits. But lets say we don't have 4 data bits but instead we have 3 data bits.

What will happen then?

Lets assume a error happens during the transmission of the data:

$$D3D2P3D1P2P1 -> D3'D2'P3D1'P2P1$$

Given odd or even parity, which data bits do we have to check for each parity bits at the receiver now?

If we had 4 data bits for P1->f(D1',D2',D4') , P2->f(D1',D3',D4') , P3->f(D3',D4',D5').

  • \$\begingroup\$ I am not following the entire question, so I can't answer. In the real world, you will often have less data bits than the code can correct, just assume that the extra data bits are zero. \$\endgroup\$
    – Mattman944
    May 18, 2022 at 12:43
  • \$\begingroup\$ Where do you get confused? \$\endgroup\$
    – Jun Seo-He
    May 18, 2022 at 12:46
  • \$\begingroup\$ since you have only 6 bits total, m=3, n=3 , Are you asking? how do you compute error correction? or is it m=4 bits with msb=0? or simply how do you detect errors? As @Mattman said with 7 bits, just assume 1 spare bit=0 \$\endgroup\$ May 18, 2022 at 13:29
  • \$\begingroup\$ Yes Tony how do you compute error detection in the case of m,n = 3. \$\endgroup\$
    – Jun Seo-He
    May 18, 2022 at 13:35
  • \$\begingroup\$ This is done using 2^n - 1 decoder to compute the Redundant bits and compare with what was received, then if there is an error, the Residual value addresses the bit position in error for single bit errors only. \$\endgroup\$ May 18, 2022 at 13:49

1 Answer 1


I have used 4 bit Hamming codes for an Error Correction syndrome and some 2 or more bit errors for detection. It was in the '70's using TTL for my SCADA network to improve reliability on the command path side with industrial welding arc noise near coaxial telemetry. At that time, the Chinese Remainder Theorem was most popular for low latency Video editing and CRC/ECC for HDD's for correction up to 11-bit single-burst errors per sector.

I have never had to use a 6-bit word with 3 data bits (6,3) as in this question.

This appears to be better realized as a Bose-Chaudhuri-Hocquenghem, BCH (6,3) code rather than a 2-bit Hamming + Parity. The popular Hamming ones must have an odd total bit-length that optimizes codeword efficiency like (7,4) or (15,11). Then there are simple examples with 1-bit parity (8,7) or (9,8) or (17,16) or (33,32).

That is a good description pasted partly below;

Department of Electrical and Computer Engineering - University of New Brunswick, Fredericton, NB, Canada


You can test "non-Codewords here to test the ED/EC & Results



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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