Hamming(7,4) Error Correction

Encode 4 data bits → 7-bit codeword. Detect and correct any single-bit error.

1. Input Message (4 bits) — click to toggle

--
Decimal value
57%
Code rate (4/7)
3
Min distance
Encoding
Click bits to set message, then encode.

2. Codeword (7 bits) — click to flip (introduce error)

Transmitted codeword
Encode first.

Parity Check Matrix H

Columns 1,2,4 (powers of 2) are parity positions. The syndrome s = H·r (mod 2) gives the error position directly.

3. Syndrome Calculation

Syndrome appears after decoding.

4. Corrected Output

Result appears after decoding.

vs Repetition Code

Hamming(7,4): rate=4/7≈0.571, corrects 1 error in 7 bits
Repetition(3): rate=1/3≈0.333, corrects 1 error in 3 bits (but carries 1 bit!)
Hamming wins: higher rate with same 1-error correction capability.

Parity positions: p1 covers bits {1,3,5,7}, p2 covers {2,3,6,7}, p4 covers {4,5,6,7}.
Each parity bit makes its set have even parity. Syndrome = binary address of error bit.