Let and . The binary Hamming code of order is the linear code , where is an matrix whose columns are the nonzero vectors of , each once. Different orderings of the columns give codes that differ by a permutation of coordinates.
Its parameters are . The distance is 3 because the columns of are nonzero and distinct, so no two are dependent, while any two columns sum to a third. A single error in position has syndrome equal to the -th column, which identifies . The code meets the Hamming bound with equality and is therefore perfect. It was introduced by Hamming.
For , with columns in the order of the binary numerals of ,
a code.
The dual of the Hamming code is the simplex code , generated by ; all its nonzero words have weight . For the simplex code is contained in the Hamming code, that is, the Hamming code is dual-containing: any two rows of , equal or not, have an even number of common ones. Adding an overall parity bit gives the extended Hamming code .