The MacWilliams’ identity for linear codes relates the Hamming weight distribution of a code to the Hamming weight distribution of its associated dual code. The following derivation is based on probabilistic arguments and was first presented in (Chang and Wolf 1980). It makes use of the probability of undetected error, which is calculated in two different ways, and then the two results are equated. Applying the same transformation to the Hamming distance distribution of a nonlinear code, one obtains a set of nonnegative numbers with interesting interpretations in some cases.
The binary symmetric channel (BSC) with crossover probability ε, 0 ≤