Hamming distance for binary codes can be calculated using the binomial coefficient.

Let x be a binary codeword of length n, i.e. xZ2n.

There are exactly (nk) elements of Z2n that are exactly Hamming distance k away from x.


Proof

Let xZ2n.
Then x has n positions which each can be either element of Z2={0,1},
and there is exactly one way each position can differ from its current state;

Since the binomial coefficient is isomorphic to a combination, i.e. there are (nk) ways to "choose" an unordered set of k elements from a fixed set of n elements;
Since the Hamming distance dH(x,y) is defined as the number of positions where x and y disagree,
and to be distance k away from a codeword is to choose (order independent) k positions to flip,

there are exactly (nk) possible ways to change k positions.

QED

Powered by Forestry.md