How Does a Hamming (7,4) Syndrome Point to the Flipped Bit?
Each parity bit checks exactly the positions whose binary number has that parity bit's place value set, so a single flipped bit at position j upsets exactly the checks that make up j in binary. Recompute the three checks on the received word, read them as the binary number s4 s2 s1, and that number is the flipped position, with 0 meaning no error. Flip position 6 and the syndrome comes out 110, which is 6.
What you'll learn
- The bit layout and parity convention this post uses, stated in full
- Why the syndrome equals the position of a single error
- A worked example: encode 1011, flip position 6, find and fix the error
- What goes wrong when two bits flip
- The code's rate and minimum distance, and what each one means
Which layout and parity convention?
Number the seven bits from position 1 on the left to position 7 on the right. The parity bits p1, p2 and p4 sit at the positions that are powers of two, and the four data bits d1, d2, d3, d4 fill positions 3, 5, 6 and 7. Every parity bit makes its group have even parity: an even number of 1s. p1 covers positions 1, 3, 5, 7; p2 covers 2, 3, 6, 7; and p4 covers 4, 5, 6, 7. Some textbooks use a systematic layout with the four data bits first and the parity bits after them. That code corrects single errors just as well, but its syndrome is no longer the position number in binary, so always check which layout a question uses.
Why does the syndrome equal the error position?
Write each position in binary: 1 is 001, 2 is 010, 3 is 011 and so on up to 7, which is 111. The rule for the groups is that p1 covers every position whose last binary digit is 1, p2 every position whose middle digit is 1, and p4 every position whose first digit is 1. Now suppose only position j flips. A parity check fails exactly when its group contains j, which happens exactly when the matching binary digit of j is 1. So the pattern of failed checks, written as s4 s2 s1, is j itself. Because every position from 1 to 7 has a different binary number, every single error gives a different, non-zero syndrome.
Worked example: encode 1011, flip position 6
- Place the data: d1 = 1 at position 3, d2 = 0 at position 5, d3 = 1 at position 6 and d4 = 1 at position 7.
- p1 makes positions 1, 3, 5, 7 even: the data there are 1, 0, 1, so p1 = 1 ⊕ 0 ⊕ 1 = 0.
- p2 makes positions 2, 3, 6, 7 even: the data are 1, 1, 1, so p2 = 1.
- p4 makes positions 4, 5, 6, 7 even: the data are 0, 1, 1, so p4 = 0.
- The codeword, positions 1 to 7, is 0110011.
- Noise flips position 6, so the receiver gets 0110001.
- Recheck: s1 = r1 ⊕ r3 ⊕ r5 ⊕ r7 = 0 ⊕ 1 ⊕ 0 ⊕ 1 = 0; s2 = r2 ⊕ r3 ⊕ r6 ⊕ r7 = 1 ⊕ 1 ⊕ 0 ⊕ 1 = 1; s4 = r4 ⊕ r5 ⊕ r6 ⊕ r7 = 0 ⊕ 0 ⊕ 0 ⊕ 1 = 1.
- Syndrome s4 s2 s1 = 110 = 6. Flip position 6 back to get 0110011, and read the data from positions 3, 5, 6, 7: 1011, as sent.
Every single error and its syndrome
| Flipped position | Which bit | Syndrome s4 s2 s1 |
|---|---|---|
| 1 | p1 | 001 |
| 2 | p2 | 010 |
| 3 | d1 | 011 |
| 4 | p4 | 100 |
| 5 | d2 | 101 |
| 6 | d3 | 110 |
| 7 | d4 | 111 |
What happens if two bits flip?
The minimum Hamming distance between any two codewords is 3. That is enough to correct any single error, or to detect any double error, but not both at once. A decoder built to correct will misfire on a double error. Take the same codeword 0110011 and flip positions 3 and 5. The syndrome is 3 ⊕ 5 = 011 ⊕ 101 = 110, which points at position 6. The decoder flips that bit too and outputs data 0101 instead of 1011, three data bits wrong instead of two. The usual fix is to add an eighth bit that is the parity of all seven, giving the extended (8,4) code: a non-zero syndrome with that overall parity still correct signals a double error, which the decoder then reports instead of making worse.
Rate and distance in one line each
The code rate is 4/7 = 0.571: four data bits for every seven sent. The minimum distance of 3 means at least three bits must change to turn one codeword into another, which is what lets one error be located without ambiguity.
Common mistakes
- Reading the syndrome as s1 s2 s4 instead of s4 s2 s1. The most significant bit is the check of p4.
- Using odd parity when the question specifies even, or the other way round. It changes every parity bit.
- Leaving the parity bit out of its own check when computing the syndrome. On the receiving side each check includes its parity bit.
- Applying the position-number shortcut to a systematic layout with parity bits at the end, where the syndrome maps to positions differently.
- Assuming the decoder will always help. With two errors a single-error-correcting decoder can make the data worse.
Check your understanding
- Q1. Encode the data 0110 with this layout and even parity. Answer: 1100110 (p1 = 1, p2 = 1, p4 = 0).
- Q2. The receiver gets 1100010. Which bit is wrong, and what are the data? Answer: the checks give s4 s2 s1 = 101, so position 5 is wrong; correcting it gives 1100110 and data 0110.
- Q3. Which positions does p4 check, and why? Answer: 4, 5, 6 and 7, the positions whose binary number (100, 101, 110, 111) has its first digit set.
Related
Official source
Last verified
The GATE 2027 EC syllabus lists fundamentals of error correction, Hamming codes and CRC under Section 7, Communications (checked against the official PDF from IIT Madras on 10 October 2026). The encoding, every syndrome, the minimum distance and the double-error case were all checked by exhaustive computation in code.