Skip to main content
KetQat

Appearance

Definition · introductory

Hamming code

The binary Hamming code of order r has a parity-check matrix whose columns are all nonzero binary vectors of length r. It has parameters [2^r − 1, 2^r − 1 − r, 3], corrects one error and is perfect; its dual is the simplex code.

Established definitionMachine-checkedUpdated 2026-12-01 · last verified 2026-12-01

AI-assisted text, machine-checked, not yet reviewed by a person. Citations resolve and an automated pass compared the statements with the cited sources. That is not peer review; check the sources for anything you depend on.

Let r≥2r \ge 2 and n=2r−1n = 2^r - 1. The binary Hamming code of order rr is the linear code ker⁡Hr⊆F2n\ker H_r \subseteq \F_2^n, where HrH_r is an r×nr \times n matrix whose columns are the nn nonzero vectors of F2r\F_2^r, each once. Different orderings of the columns give codes that differ by a permutation of coordinates.

Its parameters are [ 2r−1,  2r−1−r,  3 ][\,2^r - 1,\; 2^r - 1 - r,\; 3\,]. The distance is 3 because the columns of HrH_r are nonzero and distinct, so no two are dependent, while any two columns sum to a third. A single error in position ii has syndrome equal to the ii-th column, which identifies ii. The code meets the Hamming bound with equality and is therefore perfect. It was introduced by Hamming.

For r=3r = 3, with columns in the order of the binary numerals of 1,…,71, \dots, 7,

H3=(000111101100111010101),H_3 = \begin{pmatrix} 0 & 0 & 0 & 1 & 1 & 1 & 1 \\ 0 & 1 & 1 & 0 & 0 & 1 & 1 \\ 1 & 0 & 1 & 0 & 1 & 0 & 1 \end{pmatrix},

a [7,4,3][7, 4, 3] code.

The dual of the Hamming code is the simplex code [ 2r−1,  r,  2r−1 ][\,2^r - 1,\; r,\; 2^{r-1}\,], generated by HrH_r; all its nonzero words have weight 2r−12^{r-1}. For r≥3r \ge 3 the simplex code is contained in the Hamming code, that is, the Hamming code is dual-containing: any two rows of HrH_r, equal or not, have an even number of common ones. Adding an overall parity bit gives the extended Hamming code [ 2r,  2r−1−r,  4 ][\,2^r,\; 2^r - 1 - r,\; 4\,].

Instance of
Related

Open in the knowledge graph

Contributions about this record

Nobody has published a contribution about it yet.

Publish a result, reproduction or commentPropose a correction to this page

References

  1. R. W. Hamming (1950). Error Detecting and Error Correcting Codes. Bell System Technical Journal 29 (2), 147-160. doi:10.1002/j.1538-7305.1950.tb00463.x
  2. W. Cary Huffman, Vera Pless (2003). Fundamentals of Error-Correcting Codes. Cambridge University Press. doi:10.1017/CBO9780511807077

Contributors

  • KetQat maintainers · @ketqatConceptualization; Supervision (CRediT roles)
  • Claude (AI drafting assistant)Writing, original draft (CRediT roles)

Review history

  1. Automated source check · Pass · 2026-12-01 · Independent automated verification pass (AI, not the drafting session)

    Parameters, distance argument, displayed H_3, perfectness, simplex dual [2^r-1, r, 2^(r-1)], dual-containment for r >= 3 (and its failure for r = 2) and extended code [2^r, 2^r-1-r, 4] checked by exhaustive enumeration for r = 2, 3, 4 (numpy script) and compared with Guruswami-Rudra-Sudan, Essential Coding Theory (open draft), Def. 2.4.1, Prop. 2.4.2, Thm 2.5.1, Defs/Prop 2.6.2-2.6.3 and its attribution of the code to Hamming; Crossref metadata of hamming-1950 and huffman-pless-2003 checked.

Revision history

  1. 2026-12-01Content release 2.1.0: 35 more topics, an independent source check of every record, intake hardening (#17)80537b7e
  2. 2026-11-30KetQat Commons: free learning paths, knowledge records, research problems, literature intake (#14)571c9b10

Current revision cdc97fce6a19f804. Source file knowledge/records/definition/hamming-code.md in the content repository (readable there once it is public).