Corrupt bit 5 of 0110011 and decode — Hamming code
introthe syndrome is the error position
Answer
syndrome = 5, single error corrected
Why this example is worth doing
Flip one bit and recompute the three parity checks: the failing checks, read as a binary number, give the position of the flipped bit directly. That is the whole elegance of the code, and it works because position p is covered by exactly the parity bits whose positions appear in p's binary expansion. The tool lets you flip any bit and watch the syndrome track it, which makes the property obvious in a way the algebra does not.
Try your own input in the Hamming code. Encode, inject an error, and watch the syndrome point straight at the flipped bit.
How the answer is reached
Hamming (7,4) decode
Received0110111Highlighted cells are parity bits.
| Check | Parity bit | Positions checked | Result |
|---|---|---|---|
| s0 | p1 | 1, 3, 5, 7 | 1 (fails) |
| s1 | p2 | 2, 3, 6, 7 | 0 (passes) |
| s2 | p4 | 4, 5, 6, 7 | 1 (fails) |
p1 check0 ⊕ 1 ⊕ 1 ⊕ 1 = 1— checks positions 1, 3, 5, 7
p2 check1 ⊕ 1 ⊕ 1 ⊕ 1 = 0— checks positions 2, 3, 6, 7
p4 check0 ⊕ 1 ⊕ 1 ⊕ 1 = 1— checks positions 4, 5, 6, 7
Syndrome S101₂ = 5— read with s₀ as the least significant bit
Syndrome 5 = 101₂, so position 5 is wrong — flip it.
Corrected0110011Highlighted cells are parity bits.
Data word1011
A single-error-correcting code cannot tell a double error from a single error; the syndrome then points at an innocent bit.
Source: R. W. Hamming, Bell System Technical Journal 29(2):147–160 (1950)