Why parity bits sit at positions 1, 2, 4, 8 — Hamming code

corethe placement is the algorithm

Answer

H is 4×15

Why this example is worth doing

Each parity bit at position 2ᵏ covers exactly those positions whose k-th bit is set, so every data position is covered by a unique combination of parity bits — its own binary expansion. The syndrome therefore cannot help but spell out the error position. The page presents the coverage table and lets the reader verify that no two positions share a pattern, which is the proof that single errors are always locatable.

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 (15,11) matrices over GF(2)

Position-ordered parity-check matrix H: column c is position (c + 1) written in binary, least significant bit in row 0.

H (position-ordered) — Hamming (15,11) matrices over GF(2)
123456789101112131415
101010101010101
011001100110011
000111100001111
000000011111111
G (position-ordered): row i is the codeword of the unit data word e_i — Hamming (15,11) matrices over GF(2)
123456789101112131415
111000000000000
100110000000000
010101000000000
110100100000000
100000011000000
010000010100000
110000010010000
000100010001000
100100010000100
010100010000010
110100010000001

Systematic form puts the payload first: G = [I_k | P] and H = [Pᵀ | I_{n−k}], so G·Hᵀ = P + P = 0.

G = [I_k | P] — Hamming (15,11) matrices over GF(2)
123456789101112131415
100000000001100
010000000001010
001000000000110
000100000001110
000010000001001
000001000000101
000000100001101
000000010000011
000000001001011
000000000100111
000000000011111
H = [Pᵀ | I_{n−k}] — Hamming (15,11) matrices over GF(2)
123456789101112131415
110110101011000
101101100110100
011100011110010
000011111110001
Warning:

Encoding is c = m·G and the syndrome is s = H·rᵀ, both over GF(2).

Source: R. W. Hamming, Bell System Technical Journal 29(2):147–160 (1950)

Compare with

Open the Hamming code

This input is entered in the tool itself — it is too rich for a link to carry.

Note:

Notation this page assumes

  • Bit strings are written most significant bit first, and bit 0 is the least significant bit.
  • A width is stated explicitly wherever it changes the answer; nothing is silently sign-extended or truncated.
  • Hamming positions are numbered from 1 at the left, and parity bits sit at the powers of two — positions 1, 2, 4, 8.

Sources

  • Hamming, “Error Detecting and Error Correcting Codes” (1950)