Back to the on-screen lesson ·
s = Hr^T = He^T; cosets and coset leaders; single-error correction by matching a column.
Paper packet. Every task here also exists on screen, where it is checked automatically; answers written on paper are not assessed by Nydus. When you are back at a device, enter your answers there.
By the end of this lesson you will be able to compute the syndrome of a received word, explain why it depends only on the error pattern, describe the cosets of a linear code and their leaders, and perform syndrome decoding by hand, including locating and correcting a single error by matching the syndrome to a column of the parity-check matrix. You will construct the Hamming code for any number of parity bits, state its length, dimension, rate and minimum distance, decode it in one step with the binary column ordering, and prove that it is perfect by counting syndromes against error patterns.
Send a codeword $c$; the channel adds an error pattern $e$, a word with $1$s where bits were flipped; receive $r = c + e$. The syndrome $s = Hr^T = Hc^T + He^T = He^T$ depends on $e$ alone. All $2^n$ words split into $2^{n-k}$ cosets $c + \text{code}$, and words in the same coset share a syndrome; the coset leader is the lowest-weight word in the coset, the most likely error with that syndrome on a BSC with $\varepsilon < \tfrac{1}{2}$. Syndrome decoding: compute $s$, look up its coset leader $\hat{e}$ in a table of $2^{n-k}$ entries, output $r + \hat{e}$. This is nearest-codeword decoding with a table exponential in $n - k$ rather than in $k$. For single errors the table is $H$ itself: an error in position $i$ has syndrome equal to column $i$ of $H$, so if $H$ has distinct nonzero columns every single error is located by matching the syndrome to a column. Two errors give the sum of two columns, which for $d = 3$ is nonzero (detected) but may coincide with a third column (miscorrected).
Another way: example
Hamming $[7, 4]$ with column $i$ of $H$ equal to binary $i$. Received $r = 0001001$: the $1$s are at positions $4$ and $7$, so $s = 100 \oplus 111 = 011 = 3$. Flip bit $3$: $0011001$, whose syndrome $011 \oplus 100 \oplus 111 = 000$ confirms a codeword.
Another way: steps
Send a codeword $c$; the channel adds an error pattern $e$ with a $1$ wherever a bit flipped; you receive $r = c + e$. Now compute the syndrome $$s = Hr^T = Hc^T + He^T = He^T,$$ because $Hc^T = 0$ for every codeword. The syndrome does not depend on which codeword was sent — only on the error. That is the whole idea: a decoder that knows $s$ knows everything the parity checks can tell it about the damage, and nothing about the message.
All $2^n$ words split into $2^{n-k}$ cosets $c + \text{code}$, one per syndrome, and every word in a coset has the same syndrome. The coset leader is the lowest-weight word in the coset — the most likely error with that syndrome, as long as the channel flips each bit with probability under $\tfrac{1}{2}$. So syndrome decoding is three steps: compute $s$, look up its coset leader $\hat{e}$, output $r + \hat{e}$. It is nearest-codeword decoding with a table of $2^{n-k}$ entries instead of a search over $2^k$ codewords — exponential in the redundancy rather than in the message.
| syndrome $s$ | coset leader $\hat{e}$ | what the decoder does |
|---|---|---|
| $000$ | $0000000$ | accept the word unchanged |
| $001$ | $1000000$ | flip position $1$ |
| $010$ | $0100000$ | flip position $2$ |
| $011$ | $0010000$ | flip position $3$ |
| $100$ | $0001000$ | flip position $4$ |
| $111$ | $0000001$ | flip position $7$ |
For a Hamming code the table is not even needed. Order the columns of $H$ as the binary numbers $1$ to $n$; then the syndrome of a single error at position $i$ is the $i$-th column, which is $i$ in binary. Read the syndrome as a number and you have the position.
| received word | syndrome | error position | corrected codeword |
|---|---|---|---|
| $0001001$ | $011$ | $3$ | $0011001$ |
| $0111000$ | $101$ | $5$ | $0111100$ |
| $1000110$ | $010$ | $2$ | $1100110$ |
| $1111110$ | $111$ | $7$ | $1111111$ |
| $0101001$ | $001$ | $1$ | $1101001$ |
| $0011011$ | $110$ | $6$ | $0011001$ |
| $1101110$ | $100$ | $4$ | $1100110$ |
Common mistakes
Hamming $[7, 4]$, received $1000110$: $1$s at positions $1, 5, 6$, syndrome $001 \oplus 101 \oplus 110 = 010 = 2$.
XOR the binary positions.
Flip bit $2$: $1100110$; check $001 \oplus 010 \oplus 101 \oplus 110 = 000$. Decoded.
The $[5, 2]$ code with $H = [A^T \mid I_3]$ has $2^3 = 8$ cosets. Five of them have a weight-$1$ leader (the single errors), one is the code itself.
The remaining two cosets need weight-$2$ leaders: the decoder corrects two particular double errors as well, but not all of them.
Not a perfect code.
The $1$s are at positions $1$ to $6$, so $s$ is the XOR of the columns $001, 010, 011, 100, 101, 110$.
Column by column: $001 \oplus 010 = 011$; $\oplus 011 = 000$; $\oplus 100 = 100$; $\oplus 101 = 001$; $\oplus 110 = 111$.
Pairs that repeat cancel, so the order does not matter.
$s = 111 = 7$: flip position $7$, giving $1111111$, whose syndrome is $000$.
A $[15, 11]$ code has $r = 4$ redundant bits, so $2^4 = 16$ syndromes.
Sixteen coset leaders: the zero pattern and fifteen single errors, one per position.
$1 + 15 = 16$ exactly, which is what makes the Hamming code perfect.
There is no room left for a double error: every syndrome is already spoken for.
$1$s at positions $1$ to $6$: $001 \oplus 010 \oplus 011 \oplus 100 \oplus 101 \oplus 110 = 111$.
Syndrome $7$: flip bit $7$, giving $1111111$.
A Hamming $[7, 4]$ code has $H$ whose column $i$ is the binary representation of $i$ (columns $001, 010, 011, \ldots, 111$). A received word has syndrome $110$. Which position (1-based) is in error?
Computed value: answer
With the same Hamming $[7, 4]$ code (column $i$ of $H$ = binary $i$), the word $1111110$ is received. Give its syndrome and the corrected codeword.
syndrome s, codeword c
An $[\,14, 6\,]$ linear code: how many distinct syndromes are there, and hence how many error patterns can syndrome decoding correct at most (counting the zero pattern)?
Computed value: answer
A Hamming $[7, 4]$ code has $H$ whose column $i$ is the binary representation of $i$ (columns $001, 010, 011, \ldots, 111$). A received word has syndrome $001$. Which position (1-based) is in error?
Computed value: answer
Why does syndrome decoding work, and what does the decoder store?
Lesson test: one question per skill, one attempt each, no hints. Your answers are checked when you submit.
With the same Hamming $[7, 4]$ code (column $i$ of $H$ = binary $i$), the word $1111110$ is received. Give its syndrome and the corrected codeword.
syndrome s, codeword c
You can decode any single error with a syndrome and build the perfect Hamming codes. Next: the bounds that say how good any code can possibly be.
9. Your turn: Hamming $[7, 4]$, received $1111110$, step 2