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.

Which positions each Hamming parity bit checksThree overlapping circles labelled p1, p2 and p4. Each region holds one bit position of the codeword 0110011. Position 1 is only in p1, 2 only in p2, 4 only in p4. Position 3 is in p1 and p2, 5 in p1 and p4, 6 in p2 and p4, and 7 in all three. The bit values are: position 1 is 0, 2 is 1, 3 is 1, 4 is 0, 5 is 0, 6 is 1, 7 is 1. Every circle holds an even number of 1s.p1p2p4pos 10pos 21pos 40pos 31pos 50pos 61pos 71
The three parity groups as circles, with the bits of the codeword 0110011 in their regions. Position 7 lies in all three circles, positions 3, 5 and 6 in two, and each parity bit in one. Every circle holds an even number of 1s.

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.
Computing the syndrome for a received word with position 6 flippedA grid with columns for positions 1 to 7. The sent codeword is 0110011 and the received word 0110001, so position 6 changed. Row s1 marks positions 1, 3, 5 and 7, whose received bits sum to 0 modulo 2. Row s2 marks positions 2, 3, 6 and 7, sum 1. Row s4 marks positions 4, 5, 6 and 7, sum 1. Reading s4 s2 s1 as binary gives 110, which is 6, the flipped position.1234567sumsent0110011rx0110001s1••••0s2••••1s4••••1syndrome s4 s2 s1 = 110 = 6
The sent and received words, with a dot in each position a check covers. Only s2 and s4 fail, and 110 in binary is 6.

Every single error and its syndrome

Single-bit errors in the (7,4) code with parity at positions 1, 2 and 4. A check in code confirms all 7 errors are corrected for all 16 data words.
Flipped positionWhich bitSyndrome s4 s2 s1
1p1001
2p2010
3d1011
4p4100
5d2101
6d3110
7d4111

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.